Source code

Revision control

Copy as Markdown

Other Tools

<!DOCTYPE html>
<meta charset="utf-8">
<title>SVG coordinate systems: transform attribute on the outermost svg element (reference)</title>
<link rel="author" title="Nikolas Zimmermann" href="mailto:nzimmermann@igalia.com">
<style>
.container { display: flex; width: 600px; height: 200px; background-color: gold; }
</style>
<div class="container">
<svg width="200" height="200" viewBox="-14.08 -12.28 80 80" fill="none" stroke="white" stroke-width="1.5">
<rect x="2" y="5" width="20" height="14" rx="2"/>
<path d="M2 10h20"/>
</svg>
<svg width="200" height="200" viewBox="0 -5 40 40">
<rect x="2" y="2" width="16" height="16" fill="green"/>
</svg>
<svg width="200" height="200" viewBox="-1 -1.5 20 20">
<rect x="2" y="2" width="16" height="16" fill="green"/>
</svg>
</div>