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

How to add underline in css

青灯夜游
青灯夜游Original
2021-07-22 16:30:5314631browse

You can use the text-decoration attribute in css to add an underline effect. You only need to set the "text-decoration:underline" style to the element. text-decoration specifies the decoration added to the text, and the value underline defines a line under the text.

How to add underline in css

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

In CSS, you can use the text-decoration attribute to add an underline effect. The text-decoration attribute can specify the decoration added to the text. When the value is set to underline, it can define a line under the text, that is, the underline effect.

Let’s take a look at the code example:

<!DOCTYPE html>
<html>
	<head>
		<style type="text/css">
			p {
				text-decoration: underline
			}
		</style>
	</head>

	<body>
		<p>测试文本!</p>

	</body>

</html>

Rendering:

How to add underline in css

Description:

The text-decoration attribute allows you to set 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.

Possible values:

##nonedefault. Text that defines the standard. underlineDefine a line under the text. overlineDefine a line on the text. line-throughDefine a line that passes under the text. blinkDefine blinking text. inheritSpecifies that the value of the text-decoration attribute should be inherited from the parent element.
Value Description
(Learning video sharing:

css video tutorial)

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