Home >Web Front-end >Front-end Q&A >How to remove underline in css

How to remove underline in css

藏色散人
藏色散人Original
2021-02-24 10:27:154771browse

How to remove underlines in css: First create an HTML sample file; then define an a tag in the body; finally remove the underlines by setting the css attribute to "a{text-decoration:none}".

How to remove underline in css

The operating environment of this tutorial: Windows 7 system, CSS3 version, Dell G3 computer.

After adding a hyperlink anchor text (html a) to the text, the font is automatically underlined by default, but you can use CSS to cancel the underlined style of the text font that removes the hyperlink on the entire web page.

Canceling underline in css can be achieved using the text-decoration:none style.

Example:

<!DOCTYPE html> 
<html> 
<head> 
<meta charset="utf-8" /> 
<title>取消下划线</title> 
<style> 
a{ text-decoration:none} 
</style> 
</head> 
<body> 
欢迎来到<a href="//m.sbmmt.com/">PHP中文网</a>! 
</body> 
</html>

The text-decoration attribute specifies the decorations added to the text.

[Recommended: css video tutorial]

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 默认。定义标准的文本。
underline 定义文本下的一条线。
overline 定义文本上的一条线。
line-through 定义穿过文本下的一条线。
blink 定义闪烁的文本。
inherit 规定应该从父元素继承 text-decoration 属性的值。

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