my fellow code masters.
I'm trying to get my header to pivot to the center. I want the clipping with overflow:hidden but when I resize the screen to portrait it clips the right side of the image and when it's landscape it clips the bottom. I want it to equally clip top, right, bottom and left.
The real image is way more complicating and just using this as the example.
Something like transform-origin: center would be super nice but it doesn't work in this case.
I made a pen Header Trick
Thanks in advance!
body{
margin: 0;
padding: 0;
}
.header{
width: 100%;
height: 90vh;
overflow: hidden;
background-color: black;
}
.theSVG{
width: 100vmax;
height: 100vmax;
}
<div class="header">
<svg viewBox="0 0 1000 1000" class="theSVG">
<rect width="1000" height="1000" style="fill:rgb(0,0,255);stroke- width:3;stroke:rgb(0,0,0)" />
<rect width="1000" height="100" style="fill:rgb(255, 0, 0);stroke-width:3;stroke:rgb(0,0,0)" />
<rect y="150" width="1000" height="100" style="fill:rgb(255, 0, 0);stroke-width:3;stroke:rgb(0,0,0)" />
<rect y="750" width="1000" height="100" style="fill:rgb(255, 0, 0);stroke-width:3;stroke:rgb(0,0,0)" />
<rect y="900" width="1000" height="100" style="fill:rgb(255, 0, 0);stroke-width:3;stroke:rgb(0,0,0)" />
<circle cx="500" cy="500" r="500" stroke="green" stroke-width="4" fill="yellow" />
</svg>
</div>