Is there a way to create an hr
line both before and after a title
using Bootstrap 5? I have managed to add the lines, but I am struggling to align the title
within a container
class in order for the lines to span the width of the screen.
My current code snippet:
.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/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="5e3c31312a2d2a2c3f2e1e6b706e706c">[email protected]</a>/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 the desired result: