Home > Web Front-end > HTML Tutorial > How to use text-decoration

How to use text-decoration

php中世界最好的语言
Release: 2018-05-30 11:49:00
Original
5547 people have browsed it

We often use CSS code to underline text content on web pages. Then we have to use text-decoration. How to use it? Today we will give you a good introduction.

Use CSS attribute words:

text-decoration : none || underline || blink || overline || line-through

text-decoration underline CSS word value parameter :

none : No decoration

blink : Blink

underline : Underline

line-through : Throughline

overline : Overline Underline

text-decoration:none No decoration, usually remove the underline style for html underline tags

text-decoration:underline Underline style

text-decoration:line-through Strikethrough style - throughline style

text-decoration:overline Overline style

HTML regular underline tag

Underline tag "U" in HTML u tag Object text is underlined in HTML.

Example:

<u>我被U标签加下滑线</u>
Copy after login

CSS control object underline attribute style

html u underline and CSS underline comparison application case

CSS removehtml tagUnderline style

If we want to remove the strikethrough style of the corresponding html s tag, remove the html u underline, and remove the html overline style.

1. Remove the html s strikethrough line style

.p s{text-decoration:none}

Remove the html s label style attribute in the p class object box

2. Remove the html u underline style

.p u{text-decoration:none}

Remove the u label underline style attribute in the p class object box

5. Hyperlink Advanced use of underline - TOP

Next we will explain common CSS hyperlinks. Text objects will be underlined when passing by them.

The code is as follows:

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html;
 charset=utf-8" /> 
<title>下划线演示</title> 
<style> 
.yangshi a{ text-decoration:none;}
/* css注释: 鼠标经过热点文字被加下划线 */ 
.yangshi a:hover{ text-decoration:underline;}
/* 鼠标经过热点文字被加下划线 */ 
</style> 
</head> 
<body> 
<p> 
<span class="yangshi"> 
<a href="http:/www.php.cn">p</a> 
</span> 
</p> 
</body> 
</html>
Copy after login

Please copy the above code and create a new HTML to view the example style.

We set the text underline, text strikethrough style, and font overline style for the three box objects respectively.

1. CSS code snippet:

.p{text-decoration:underline}

.p_1{text-decoration:line-through}

.p_2{text-decoration:overline}

2. HTML code snippet:

I am underlined

I am struck through

I am underlined

I have introduced so much, I believe you have mastered text-decoration. Friends in need can save it. Please also continue to pay attention to other updates on this site.

Related reading:

What are the functions of comments in html


How to clear floating in CSS


How to use label tags in html

The above is the detailed content of How to use text-decoration. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template