Skip to content

Commit c235491

Browse files
committed
fix: exclude svg from height:auto media rule
Inline SVGs without a viewBox have no intrinsic aspect ratio, so height:auto causes them to collapse or clip. This matches the approach used by Pico CSS, Water.css, Simple.css, and most classless libraries.
1 parent 0235d0b commit c235491

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/_media.scss

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,17 @@
88

99
@layer nimble.base {
1010

11-
:where(img, video, canvas, svg) {
11+
:where(img, video, canvas) {
1212
max-width: 100%;
1313
height: auto;
1414
}
1515

16+
// SVG gets max-width but NOT height:auto — inline SVGs without viewBox
17+
// have no intrinsic aspect ratio, so height:auto breaks them.
18+
:where(svg) {
19+
max-width: 100%;
20+
}
21+
1622
:where(figure) {
1723
margin: 0;
1824
}

0 commit comments

Comments
 (0)