CSS for underlines
Underlined text has long been a challenge in HTML and CSS. The colour of the underline could only be inherited from the text. The CSS specification did not define an underline thickness, leaving it up to individual browser vendors to determine how to derive it. This resulted in some browsers rendering thicker underlines than others, particularly at larger font sizes.
For years, the workaround was to avoid underlines altogether and use a border as a pseudo underline. However, this approach was deemed inelegant and unsightly, as underlines should cross characters with descenders like g and y, but borders do not. Fortunately, beginning in 2019, new attributes have allowed for more flexibility in styling underlines.
All major browser vendors have now implemented these attributes, providing a more consistent and visually appealing way to style underlined text.
Written by urgent.news from Lobsters's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.