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
The viewBox attribute makes can be used instead of explicit width and height to define an SVG element's aspect ratio so that they act just like images do when styled with CSS (height is scaled proportionally when you only declare width, etc.). According to the spec regarding "Intrinsic sizing properties of the viewport of SVG content" (emphasis mine):
If either/both of the ‘width’ and ‘height’ of the outermost svg element are in percentage units (or omitted) (used value is auto), the aspect ratio is calculated from the width and height values of the ‘viewBox’ specified for the current SVG document fragment. If the ‘viewBox’ is not correctly specified, the intrinsic aspect ratio cannot be calculated and is considered unspecified.
Unfortunately, most of the major browsers haven't followed this part of the spec until relatively recently. Chrome 36 introduced support for intrinsic sizing by viewBox in July, 2014; Safari didn't do it until recently, but I haven't been able to hunt down the changelog to see when; Firefox was a late adopter too, but I don't know exactly when they fixed it. iOS and Android browser support should probably be listed separately, too.
The text was updated successfully, but these errors were encountered:
The viewBox attribute makes can be used instead of explicit
width
andheight
to define an SVG element's aspect ratio so that they act just like images do when styled with CSS (height is scaled proportionally when you only declarewidth
, etc.). According to the spec regarding "Intrinsic sizing properties of the viewport of SVG content" (emphasis mine):Unfortunately, most of the major browsers haven't followed this part of the spec until relatively recently. Chrome 36 introduced support for intrinsic sizing by
viewBox
in July, 2014; Safari didn't do it until recently, but I haven't been able to hunt down the changelog to see when; Firefox was a late adopter too, but I don't know exactly when they fixed it. iOS and Android browser support should probably be listed separately, too.The text was updated successfully, but these errors were encountered: