I have this code: https://codepen.io/aceraven777/pen/dyPGBeX
HTML:
<html>
<body>
<div class="box">
<div class="title-container">
<h1>title</h1>
</div>
<p>this is the description</p>
</div>
</body>
</html>
CSS:
body {
background: url('https://images.pexels.com/photos/255379/pexels-photo-255379.jpeg');
background-size: cover;
padding-top: 30px;
}
.box {
border: 2px solid white;
width: 100px;
margin: auto;
padding: 30px;
position: relative;
}
.box .title-container {
position: absolute;
top: -22px;
left: 0;
width: 100%;
text-align: center;
}
.box .title-container h1 {
background-color: transparent;
margin: 0;
padding: 3px 10px;
display: inline;
}
This is the output of the HTML:
Remember, here I'm using a background image, NOT a solid background color.
On the title part, I want the border to not strike the title, I want the border to be transparent to that part, how can I achieve this?