I want to make an hr
line before title
and an hr
line after title.
I am using Bootstrap 5
and I managed to get that before and after title
there are a line but I am stuck to make title
tag aligned using container
class and make the line from one screen side to another.
The question is how I get the lines to go full width using container
to align content.
This is what I have now:
.decorated{
overflow: hidden;
text-align: center;
}
.decorated > span{
position: relative;
display: inline-block;
}
.decorated > span:before, .decorated > span:after{
content: '';
position: absolute;
top: 50%;
border-bottom: 2px solid;
width: 591px; /* half of limiter*/
margin: 0 20px;
}
.decorated > span:before{
right: 100%;
}
.decorated > span:after{
left: 100%;
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"/>
<div class="col-md">
<div class="col-md">
<div class="">
<div class="container">
<h1 class="decorated"><span>My Title</span></h1>
</div>
</div>
</div>
</div>
This is what I should get: