viewBox Attribute
The viewBox defines the internal coordinate space. Omitting width/height lets SVG fill its container responsively.
The viewBox defines the internal coordinate space. Omitting width/height lets SVG fill its container responsively.
<!-- Fully responsive SVG -->
<svg viewBox="0 0 100 50" xmlns="http://www.w3.org/2000/svg"
style="width:100%; max-width:400px;">
<circle cx="50" cy="25" r="20" fill="steelblue"/>
<text x="50" y="30" text-anchor="middle" fill="white" font-size="10">Responsive</text>
</svg>
Set only viewBox (not width/height) for a fully responsive SVG that fills its container.