* {
font-size: 14px;
box-sizing: border-box;
}
.wrapper {
padding: 2rem;
}
.text--bigtitle {
text-transform: uppercase;
font-size: 2rem;
}
.border--short {
position: relative;
}
.border--short::after {
content: "";
display: block;
position: absolute;
height: 2px;
width: 40%;
bottom: 0;
left: 50%;
color: red;
margin-left: -20%;
}
<div class="wrapper">
<p class="border--short text--bigtitle">Short Border</p>
</div>
I am attempting to create a short bottom border specifically under a title within an html element by utilizing CSS.
Despite my efforts using the 'position:absolute' property and adjusting the width of the ::after pseudo-element, I cannot seem to get the desired result of displaying a short bottom border only. Here is the snippet of my code:
If anyone has any suggestions or solutions to this issue, it would be greatly appreciated. Thank you in advance.