How to set text underline in CSS

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-decorationto 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-decorationthe property and set its value to underline. Here's an example:

<style>
    .underline-text {
   
    
    
        text-decoration: underline;
    }
</style>

<p class=

Guess you like

Origin blog.csdn.net/CodeGu/article/details/133441262