Skip to content

Instantly share code, notes, and snippets.

@ladislavsulc
Last active February 18, 2021 17:28
Fluid Images
// 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