Is it possible to make a div border masked in a specific place like in the picture above?
Some kind of div masks another div without setting a background-color
(because the background of a whole site is a gradient).
I don’t want to use an SVG, cause I want to keep border properties available to use.
I tried to use pseudo elements with the mask
property with a black SVG rectangle inside of it but the border is still visible (even if I placed a mask inside of the .card
div without ::after
.
.card {
position: relative;
display: flex;
flex-direction: column;
height: 100%;
width: 100%;
padding: 2rem;
border: 1px solid var(--border-color);
border-radius: 2vw;
}
.card::after {
content: "";
position: absolute;
width: 50px;
height: 10px;
top: -5px;
left: 50%;
transform: translateX(-50%);
-webkit-mask: url("../../assets/rect-mask.svg");
mask: url("../../assets/rect-mask.svg");
}
2
Answers
You can use
clip-path
:you can use a
<fieldset>
and<legend>
elements..