I want to display an SVG image inside a position:fixed div. I have
<div class="main">
<svg class="svg" viewBox="0 0 180 100">
<rect height="100%" width="100%" fill="#003300"></rect>
</svg>
</div>
and style
.main {
position:fixed;
left: 100px;
height: 100%;
width:100%;
background: #33AAAA;
}
.svg {
display: block;
height: 100%;
width: 100%;
position:static;
}
I want to center the SVG horizontally and vertically. I get a strange behavior. Changing the size of the browser window, shows that when the svg is smaller than available width, it is weirdly placed. For example: there is more space on the left than on the right.
Codepen (including CSS reset): Codepen