In web design and development, we often need to style text, including fonts, colors, sizes, etc. Among them, setting text underline is a common requirement. This article will introduce how to use CSS to set text underline and provide corresponding source code examples.
Properties are used in CSS text-decoration
to set text decoration effects, including underlining. Here are some commonly used values:
none
:Default value, no decorative effect is set.underline
: Set the underline to be displayed below the text.overline
:Set to display an underline above the text.line-through
:Set to display strikethrough in the middle of text.blink
: Set text flashing.
To underline text we can use text-decoration
the property and set its value to underline
. Here's an example:
<style>
.underline-text {
text-decoration: underline;
}
</style>
<p class=