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
<p><strong>Note:</strong> The CSS classes <code>img-cover</code> and <code>img-contain</code> are designed to work on the <code><img></code> tag. They may not work very well on an embedded <code><svg></code> (i.e. if you copy-pasted the SVG code into the HTML). But they work fine if an SVG image is inserted into a page the normal way for images: via the <code><img></code> tag.</p>
<p>What if you don’t want the blurry edges spreading outside of the image rectangle? Then you can wrap the image in a block that has the <code>overflow-hidden</code> utility class.</p>
<imgclass="img-cover img-blur" src="/codebase-5/img/pexels-pixabay-416179.jpg" width="600" height="600" loading="lazy" alt="Photo by Pixabay from Pexels">
725
+
<p>What if you don’t want the blurry edges spreading outside of the image rectangle? Then you can wrap the image in a block that has the <code>overflow-clip</code> utility class.</p>
726
+
<divclass="overflow-clip">
727
+
<imgclass="aspect-ratio-16x9 img-cover img-blur" src="/codebase-5/img/pexels-pixabay-416179.jpg" width="600" height="600" loading="lazy" alt="Photo by Pixabay from Pexels">
Copy file name to clipboardExpand all lines: src/docs/4-decoration-utilities/images.md
+7-11Lines changed: 7 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,7 @@ Follow these two rules when using `img-cover`:
42
42
43
43
2. Be sure to optimize the filesize of your image. You don’t want to make your visitor wait a long time (several seconds, or more) for your image to load if they have a slow connection.
44
44
45
-
Many web platforms have _image processors_ built in, or added via a plugin. For example:
45
+
Many web platforms have _image processors_ built in, or added via a plugin. For example:
46
46
47
47
* The [Eleventy](https://www.11ty.dev) static site generator has an [Eleventy-image plugin](https://www.11ty.dev/docs/plugins/image/)
48
48
*[WordPress](https://wordpress.org) has a [built-in image processor](https://www.wpbeginner.com/beginners-guide/wordpress-image-sizes-beginners-guide/) for automatic image resizing and loading for different sized devices (and lazy loading). Plus, there are several image-optimizer plugins.
@@ -165,32 +165,28 @@ The image below is a square, therefore on wider viewports, there will be empty s
165
165
166
166
### Grayscale filter
167
167
168
-
<divstyle="height: 460px;">
169
-
<imgclass="img-cover img-grayscale"src="{{ '/img/pexels-pixabay-416179.jpg' | url }}"width="600"height="600"loading="lazy"alt="Photo by Pixabay from Pexels">
170
-
</div>
168
+
<imgclass="aspect-ratio-16x9 img-cover img-grayscale"src="{{ '/img/pexels-pixabay-416179.jpg' | url }}"width="600"height="600"loading="lazy"alt="Photo by Pixabay from Pexels">
<imgclass="img-cover img-blur"src="{{ '/img/pexels-pixabay-416179.jpg' | url }}"width="600"height="600"loading="lazy"alt="Photo by Pixabay from Pexels">
180
-
</div>
176
+
<imgclass="aspect-ratio-16x9 img-cover img-blur"src="{{ '/img/pexels-pixabay-416179.jpg' | url }}"width="600"height="600"loading="lazy"alt="Photo by Pixabay from Pexels">
What if you don’t want the blurry edges spreading outside of the image rectangle? Then you can wrap the image in a block that has the `overflow-hidden` utility class.
182
+
What if you don’t want the blurry edges spreading outside of the image rectangle? Then you can wrap the image in a block that has the `overflow-clip` utility class.
<imgclass="img-cover img-blur"src="{{ '/img/pexels-pixabay-416179.jpg' | url }}"width="600"height="600"loading="lazy"alt="Photo by Pixabay from Pexels">
184
+
<divclass="overflow-clip">
185
+
<imgclass="aspect-ratio-16x9 img-cover img-blur"src="{{ '/img/pexels-pixabay-416179.jpg' | url }}"width="600"height="600"loading="lazy"alt="Photo by Pixabay from Pexels">
0 commit comments