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

How to set a single text style in css

下次还敢
Release: 2024-04-25 13:39:14
Original
645 people have browsed it

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>
Copy after login

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>
Copy after login

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>
Copy after login

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!

Related labels:
css
source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template