Home>Article>Web Front-end> How to set underline in css

How to set underline in css

藏色散人
藏色散人 Original
2021-04-13 09:15:34 6126browse

How to set underline in css: first create an HTML sample file; then define some text content in the body; finally add underline to the text through the "text-decoration:underline;" style.

How to set underline in css

The operating environment of this article: Windows7 system, HTML5&&CSS3 version, Dell G3 computer.

css add underline:

There are two ways to add underline style to font text. One is to use the html underline tag directly, and the other is to use the CSS underline style. Let's take a look at how to add underlines using css.

css can use the text-decoration attribute to add underlines. Use the text-decoration:underline; style to underline text.

Example:

      

This is heading 1

This is heading 2

This is heading 3

The effect is as follows:

How to set underline in css

text-decoration attribute description:

text-decoration attribute specification Modifications added to text.

Note: The modified color is set by the "color" attribute.

This attribute allows setting certain effects on text, such as underlining. If the descendant element does not have its own decorations, the decorations set on the ancestor element will "extend" to the descendant elements. User agents are not required to support blink.

Attribute value:

none Default. Text that defines the standard.

underline Defines a line under the text.

overline defines a line on the text.

line-through defines a line that passes under the text.

blink defines blinking text.

inherit specifies that the value of the text-decoration attribute should be inherited from the parent element.

【Recommended learning:css video tutorial

The above is the detailed content of How to set underline 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