Home  >  Article  >  Web Front-end  >  How to adjust line spacing when css text exceeds the next line

How to adjust line spacing when css text exceeds the next line

WBOY
WBOYOriginal
2021-12-02 19:18:002987browse

In CSS, you can use the "line-height" attribute to adjust the line spacing of the text beyond the next line. You only need to add the "line-height: line spacing value;" style to the text element.

How to adjust line spacing when css text exceeds the next line

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

#How to adjust the line spacing when the css text exceeds the next line

You can use the line-height attribute to set when the text exceeds the next line. Yes Line spacing. The line-height property sets the distance between lines (line height).

The example is as follows:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <style type="text/css">
            div{
                width:200px;
                height:100px;
                border:1px solid black;
                overflow:hidden;
                line-height:200%;
            }
        </style>
    </head>
    <body>
        <div>css设置文本显示高度超出部分隐藏css设置文本显示高度超出部分隐藏css设置文本显示高度超出部分隐藏css设置文本显示高度超出部分隐藏css设置文本显示高度超出部分隐藏css设置文本显示高度超出部分隐藏css设置文本显示高度超出部分隐藏</div>
    </body>
</html>

Output result:

How to adjust line spacing when css text exceeds the next line

(Learning video sharing: css video tutorial)

The above is the detailed content of How to adjust line spacing when css text exceeds the next line. 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