Last active
February 18, 2021 17:28
-
-
Save ladislavsulc/f7aaec195ade0365cf3f2255a83a6dfb to your computer and use it in GitHub Desktop.
Fluid Images
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://www.zachleat.com/web/fluid-images/ | |
img { | |
max-width: 100%; | |
} | |
img[width] { | |
width: auto; /* Defer to max-width */ | |
} | |
img[width][height] { | |
height: auto; /* Preserve aspect ratio */ | |
} | |
/* Let SVG scale without boundaries */ | |
img[src$=".svg"] { | |
width: 100%; | |
height: auto; | |
max-width: none; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment