concept
Svg viewport coordinates — CSS reference
A viewBox maps a user-space rectangle into the viewport; preserveAspectRatio controls fit and alignment. The nested viewport here maps each user unit to two CSS pixels.
Formal Syntax & Structure
css syntaxcss
viewBox="0 0 120 80"Working Example
Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>SVG viewport coordinates</title><style>body{margin:0;background:white}svg{display:block}
</style><body><svg xmlns="http://www.w3.org/2000/svg" width="240" height="160" viewBox="0 0 240 160" role="img" aria-label="SVG styling example"><svg width="240" height="160" viewBox="0 0 120 80"><rect id="a" x="20" y="20" width="50" height="30"/></svg></svg></body></html>