Home  >  Article  >  Web Front-end  >  How to set the distance between css underline and text?

How to set the distance between css underline and text?

不言
不言Original
2018-10-27 11:46:1110272browse

This article will introduce to you how to set the distance between CSS underline and text. Next, let’s take a look at the specific content.

In the previous article we introduced the setting method of css underline, but the set underline feels too close to the text, and sometimes it does not look good on the web page. Beautiful, so how to set the distance between the CSS underline and the text? This article will introduce to you how to set the distance between CSS underline and text.

The text underline set by the text-decoration attribute in css cannot adjust the distance between the text and the underline, so if we want to adjust the distance between the underline and the text, we can only use the border-bottom attribute to set the text Underline, let’s look at the specific implementation method.

The attributes we need to use to set the distance between the css underline and the text are padding-bottom and border-bottom

The specific code is as follows:

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <style type="text/css">
        span{
            border-bottom: 2px solid pink;
            padding-bottom: 10px;
        }
        
    </style>
</head>
<body>
<span>
php中文网下划线距离</span>
</body>
</html>

The effect is as follows:

How to set the distance between css underline and text?

From the picture above, it can be easily seen that there is a certain distance between the text and the underline.

This article ends here. For more content, you can pay attention to the relevant tutorial columns of the PHP Chinese website! ! !

The above is the detailed content of How to set the distance between css underline and text?. 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