Home  >  Article  >  Web Front-end  >  The role of CSS text-decoration

The role of CSS text-decoration

小老鼠
小老鼠Original
2024-04-08 06:03:19746browse

The text-decoration property of CSS can add decorative effects to text, including underline, strikethrough, and overline. Usage: text-decoration: none, underline, overline, line-through.

The role of CSS text-decoration

The role of CSS text-decoration

The text-decoration attribute of CSS is used to Add decorative effects to text, such as underline, strikethrough, and overline.

Function:

text-decoration The attribute can specify the following four decorative effects:

  • underline: Add a line below the text.
  • overline: Add a line above the text.
  • line-through: Add a line in the middle of the text.
  • none: Remove all text decorations.

Syntax:

text-decoration The syntax of the attribute is as follows:

<code>text-decoration: none|underline|overline|line-through|initial|inherit;</code>

Usage:

To add decoration to the text of an element, you can use the text-decoration attribute as follows:

<code class="css">p {
  text-decoration: underline;
}</code>

The above code will be used for paragraph< The text in p> is underlined.

Examples:

Here are some examples of creating text decoration effects using different text-decoration values:

  • Underline: <p style="text-decoration: underline;">Underlined text</p>
  • ##Strikethrough :

    Strikethrough text

  • Overline:

    Underlined text

  • No decoration:

    No text decoration

##Compatibility:

The

text-decoration

attribute is widely supported in all modern browsers.

The above is the detailed content of The role of CSS text-decoration. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn