Is there a way to add a small border under a title tag using CSS? I found a solution using :after, but I'm encountering an issue when trying to center the title.
h1:after{
content: '';
display: block;
height: 4px;
width: 60px;
margin: 9px 0 0 2px;
color:#fff;
}
When the title is aligned to the left, the border is exactly where I want it. However, when I center the title, the border doesn't align properly (especially on small screens). Setting margin: 0 auto; centers the border along with the title.
Current alignment:
Desired alignment:
Any suggestions on how to achieve this responsive border alignment when centering the title? Thanks for your help!