Fit SVG into its parent
HTML
<div>
<svg viewBox="0 0 100 100">
<rect/>
</svg>
</div>
CSS
div {
width: 50%;
background: blue;
}
rect {
fill: grey;
width: 50%;
height: 50%;
}
<div>
<svg viewBox="0 0 100 100">
<rect/>
</svg>
</div>
div {
width: 50%;
background: blue;
}
rect {
fill: grey;
width: 50%;
height: 50%;
}