Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

text-decoration: underline vs border-bottom

Tags:

css

What is the difference to use {text-decoration: underline} and {border-bottom: ...}?

which is easy to style and cross browser compatible?

when we should use border-bottom over text-decoration: underline?

Would it be good to use border-bottom always in place of text-decoration: underline?

like image 909
Jitendra Vyas Avatar asked Mar 18 '10 04:03

Jitendra Vyas


People also ask

Which text-decoration property displays the line below the text?

underline: It is used to display a line below or under a text.

Which property is used to underline overline and strikethrough?

The text-decoration property adds an underline, overline, line-through, or a combination of lines to selected text.

Can you assign both underline and overline values to text-decoration property in CSS?

The text-decoration-line property is used to add a decoration line to text. Tip: You can combine more than one value, like overline and underline to display lines both over and under a text.

What style property do you use to underline text?

The property text-decoration-line is used to underline the text. This property has three values that are overline, underline, or line-through. So, the value underline is used to underline the text in CSS.


1 Answers

border-bottom puts a line at the bottom of the element box. text-decoration:underline renders the text underlined. The exact difference depends on the HTML and text layout engines in use, but in general if you want text underlined, then underline it.

like image 60
Ignacio Vazquez-Abrams Avatar answered Sep 18 '22 12:09

Ignacio Vazquez-Abrams