Skip to content

Commit 2110c0a

Browse files
update doc
add description of background image usage
1 parent 24b4905 commit 2110c0a

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Diff for: README.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,9 @@ const ciResponsive = new window.CIResponsive({
133133
});
134134
```
135135

136-
## <a name="implement"></a>Step 3: Implement in img tag
136+
## <a name="implement"></a>Step 3: Implement in img tag or use it as background image
137+
138+
### <img/> tag
137139

138140
Finally, just use the `ci-src` instead of the `src` attribute in image tag:
139141

@@ -145,6 +147,16 @@ NOTE: "ratio" is recommended to prevent page layout jumping. The parameter is us
145147

146148
<a href="https://codesandbox.io/s/6jkovjvkxz"><img src="https://codesandbox.io/static/img/play-codesandbox.svg" alt="edeit in codesandbox"/></a>
147149

150+
### background image
151+
152+
Use the `ci-bg` instead of CSS background-image property `background-image: url(...)`:
153+
154+
```html
155+
<div ci-bg="magnus-lindvall.jpg"></div>
156+
```
157+
158+
<a href="https://codesandbox.io/s/js-cloudimage-responsive-background-imxdm"><img src="https://codesandbox.io/static/img/play-codesandbox.svg" alt="edeit in codesandbox"/></a>
159+
148160
## <a name="configuration"></a> Config
149161

150162
### token

0 commit comments

Comments
 (0)