I am trying to replicate the effect where a text is surrounded by the centered border with padding around it. Example. Despite trying to use the same method as above site, the border covers the text; I must be doing something wrong which I cannot spot.
I will appreciate your help.
.header {
color:black;
font-size:3rem;
line-height:1.5;
}
.header p {
width:75%;
position: relative;
text-transform: uppercase;
text-align:center;
}
.header p::before {
display:block;
content:'';
width:100%;
position: absolute;
background:#000;
height:3px;
top:50%;
}
.header p > span{
padding:0 1rem;
display:inline-block;
max-width:75%;
position: relative;
}
<div class="header">
<p><span>Work</span></p>
</div>
This is the result I want to get.