I'm looking to create text headers that have a line behind the text to fill the entire width of the container, like this example:
Example:
The actual text itself would have a white box around it as to block out the line.
.divider-text {
height: 1px;
width: 100%;
display: inline;
overflow: hidden;
background-color: #e5e5e5;
}
This code here fills the entire text container with the #e5e5e5
color.
Consider the following markup and CSS
.heading-1{
position:relative;
text-align: center
}
.heading-1:before {
content: "";
display: block;
border-top: solid 2px #bebebe;
width: 100%;
height: 2px;
position: absolute;
top: 50%;
z-index: 0;
}
.heading-1 span {
background: #fff;
padding: 0 10px;
position: relative;
z-index: 1;
}
<h1 class="heading-1"><span>Centered Text</span></h1>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With