I have an SVG that is essentially a box with rounded edges and borders on the corners of each edge:
<div class="container">
</div>
<svg width="258" height="258" viewBox="0 0 258 258" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M257 211.489L257 245C257 251.627 251.627 257 245 257L211.489 257" stroke="white" stroke-width="2" />
<path d="M211.489 0.999998L245 0.999999C251.627 1 257 6.37258 257 13L257 46.5111" stroke="white" stroke-width="2" />
<path d="M46.5111 257L13 257C6.37258 257 1 251.627 1 245L1.00001 211.489" stroke="white" stroke-width="2" />
<path d="M1 46.5111V13C1 6.37258 6.37258 1 13 1H46.5111" stroke="white" stroke-width="2" />
</svg>
It's placed over a container div with a colored background:
body{background: white}
.container {
margin-top: 70px;
height: 400px;
margin: 0 auto;
background-color: black;
opacity: 0.55;
}
svg {
position: absolute;
top: 50px;
left: 300px;
}
I want the center of the SVG (the entire center area within the white edged borders) to be transparent. So in this example you would see the white background of the body.
Here's a CodePen of it: https://codepen.io/lance-p/pen/mdrwyyN
I was told that I could use a mask to achieve this but havent been able to get it to work. Any suggestions (with or without a mask) would be appreciated!