You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-1
Original file line number
Diff line number
Diff line change
@@ -133,7 +133,9 @@ const ciResponsive = new window.CIResponsive({
133
133
});
134
134
```
135
135
136
-
## <aname="implement"></a>Step 3: Implement in img tag
136
+
## <aname="implement"></a>Step 3: Implement in img tag or use it as background image
137
+
138
+
### <img/> tag
137
139
138
140
Finally, just use the `ci-src` instead of the `src` attribute in image tag:
139
141
@@ -145,6 +147,16 @@ NOTE: "ratio" is recommended to prevent page layout jumping. The parameter is us
145
147
146
148
<ahref="https://codesandbox.io/s/6jkovjvkxz"><imgsrc="https://codesandbox.io/static/img/play-codesandbox.svg"alt="edeit in codesandbox"/></a>
147
149
150
+
### background image
151
+
152
+
Use the `ci-bg` instead of CSS background-image property `background-image: url(...)`:
153
+
154
+
```html
155
+
<divci-bg="magnus-lindvall.jpg"></div>
156
+
```
157
+
158
+
<ahref="https://codesandbox.io/s/js-cloudimage-responsive-background-imxdm"><imgsrc="https://codesandbox.io/static/img/play-codesandbox.svg"alt="edeit in codesandbox"/></a>
0 commit comments