Is it possible in simple CSS to have a heading underlined partly only, specifically first 50px on the left?
The quickest way to underline text is to press Ctrl+U and start typing. When you want to stop underlining, press Ctrl+U again. You can also underline text and spaces in several other ways.
The <u> tag in HTML stands for underline, and it's used to underline the text enclosed within the <u> tag. This tag is generally used to underline misspelled words.
How to Underline a Title in CSS. To underline a title, you can use text-decoration: underline; but you can make it prettier if you use the border-bottom property. In the latter case, however, you need to add display: inline; so that the underline wouldn't be longer than the word itself.
You can use the :before
pseudo element and add a border to it.
h1 {
position: relative;
line-height: 1.2em;
}
h1:before {
position: absolute;
left: 0;
top: 1.2em;
height: 0;
width: 50px;
content: '';
border-top: 1px solid red;
}
<h1>This is a header, partly underlined</h1>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With