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

How to set font underline in css

王林
王林Original
2020-11-16 16:40:0310795browse

How to set font underline in css: You can use the text-decoration attribute to set it, such as [text-decoration: underline;]. The text-decoration attribute is used to specify decorations, underlines, overlines, strikethroughs, etc. added to the text.

How to set font underline in css

Attribute introduction:

text-decoration attribute specifies the decorations added to the text, such as underline, overline, strikethrough, etc.

(Video tutorial sharing: css video tutorial)

Syntax:

/*关键值*/
text-decoration: none;                     /*没有文本装饰*/
text-decoration: underline red;            /*红色下划线*/
text-decoration: underline wavy red;       /*红色波浪形下划线*/
/*全局值*/
text-decoration: inherit;
text-decoration: initial;
text-decoration: unset;

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 Define blinking text.

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

Example:

h1.under {
    text-decoration: underline;
}
h1.over {
    text-decoration: overline;
}
p.line {
    text-decoration: line-through;
}
p.blink {
    text-decoration: blink;
}
a.none {
    text-decoration: none;
}
p.underover {
    text-decoration: underline overline;
}

Related recommendations: CSS tutorial

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