Home  >  Article  >  Web Front-end  >  How to set a single text style in css

How to set a single text style in css

下次还敢
下次还敢Original
2024-04-25 13:39:14561browse

Setting a single text style in CSS can be achieved through the text-decoration attribute. You can add underline, strikethrough, overline or wavy line to the text. The syntax is: text-decoration: none | underline | overline | line -through | wavy;.

How to set a single text style in css

Set a single text style in CSS

In CSS, you can use text-decoration attribute to set the style of a single text. This property allows you to underline, strikethrough, overline, or tilde text.

Syntax:

<code class="css">text-decoration: none | underline | overline | line-through | wavy;</code>

Values:

  • none: Delete all text decorate.
  • underline: Add an underline below the text.
  • overline: Add an overline above the text.
  • line-through: Add a strikethrough in the middle of the text.
  • wavy: Add a wavy line below the text.

Usage example:

To add underline to a specific text element, you can use the following code:

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

To remove the underline of the text element To delete the line, you can use the following code:

<code class="css">.my-text {
  text-decoration: none;
}</code>

Other CSS properties:

In addition to the text-decoration property, CSS also provides some other Properties to control the text style, for example:

  • color: Set the text color.
  • font-family: Set the font family.
  • font-size: Set the font size.
  • font-weight: Set the font weight.

The above is the detailed content of How to set a single text style in css. 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
Previous article:How to set css text fontNext article:How to set css text font