Harangue Harangue - 1 year ago 141
CSS Question

Style thicker underline CSS

I wanted to add a thicker underline to my h1 tags so I used "border-bottom" as suggested in multiple Stack Overflow questions. However, the border extended well beyond the text, so I decided to add the display property "inline-block" to make the border conform to the text's bounds. This, however, made the element lack a line break after the content. I know I could always add the "br" tag, but I'd prefer to keep that in my styling. Is there anything I can do? Here is my current CSS:

border-bottom: 2px solid;
display: inline-block;

Answer Source

Try display: table instead. It acts similar to inline-block in that it collapses down to to the width of its children, but prevents surrounding inline elements from flowing along side of it the same way an ordinary block element does.


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download