Home > Web Front-end > HTML Tutorial > How to set html underline? HTML underline style example analysis

How to set html underline? HTML underline style example analysis

寻∝梦
Release: 2018-09-03 17:22:34
Original
10259 people have browsed it

This article mainly talks about the setting method of HTML underline, as well as the setting examples of HTML underline. This article is all operated with css style. I hope everyone can master more basic knowledge of css style.

First of all, we have to talk about how to set the underline:

We know that there is an underline u tag in the HTML tag ( is underlined) , adding the html underline tag u to the text font that needs to be underlined can simply implement the underline style. But in DIV CSS layout, sometimes CSS is needed to achieve the underline style effect, that is, css underline style.

1.CSS underline style word:

text-decoration

2.CSS underline code:

text-decoration:underline

3.css Underline code demonstration:

div{text-decoration:underline}
Copy after login

Add underline style to the text within the div.

Now let’s talk about the CSS font underline style example:

The following is a CSS underline setting example. The example content sets the underline style for several words in a paragraph of text.

The example code for setting the underline CSS style is as follows:

<!DOCTYPE html> 
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>PHP中文网:设置下划线实例</title> 
<style> 
.exp{ text-decoration:underline} 
</style> 
</head> 
<body> 
欢迎访问PHP中文网,<span class="exp">我被加下划线样式</span>! 
</body> 
</html>
Copy after login

The above adds an underline style to some text in a paragraph. As shown in the screenshot below:

How to set html underline? HTML underline style example analysis

Finally, let’s talk about the summary of div css underline settings:

Maybe you will think that we will use it HTML U tag is underlined, why should we use CSS text-decoration style to underline it? This is because the CSS layout is ever-changing to achieve various layouts. In order to meet different needs, the CSS styles that can be implemented by general HTML tags can be implemented. Sometimes using CSS implementation can facilitate later modification and maintenance. But on the contrary, it is not that learning CSS means not using HTML tags to achieve the required styles, but that sometimes HTML tags and CSS styles are selected and laid out according to needs to find the most suitable layout for the project, which is the important essence of DIV CSS layout. Achieve the simplest code, easy code maintenance, search engine ranking consideration, easy use by programmers, etc.

Okay, that’s the entire content of this article. If you have any questions, you can ask them below.

【Editor’s Recommendation】

html Is the tbody tag a block-level element? Basic usage of html tbody tag

How to center the Chinese characters in the col tag in html? Basic use of html col tag (examples included)

The above is the detailed content of How to set html underline? HTML underline style example analysis. 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