Home > Web Front-end > Front-end Q&A > What is used to set text height in css3

What is used to set text height in css3

WBOY
Release: 2022-06-20 15:40:34
Original
1555 people have browsed it

In CSS3, you can use the height attribute together with the overflow attribute to set the text height; the height attribute is used to set the height of the element, and the overflow attribute is used to set the text to be hidden beyond the height of the element. The syntax is "text element {height: The height value that needs to be displayed;overflow:hidden;}".

What is used to set text height in css3

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

What is used to set the text height in css3

We can set the display height of the text element through the height attribute, and set the display and hide when the text element exceeds the height through the overflow attribute.

The overflow attribute specifies what happens when content overflows the element box. When the element value is set to hidden, the excess part will be hidden.

Examples are 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;
            }
        </style>
    </head>
    <body>
        <div>css设置文本显示高度超出部分隐藏css设置文本显示高度超出部分隐藏css设置文本显示高度超出部分隐藏css设置文本显示高度超出部分隐藏css设置文本显示高度超出部分隐藏css设置文本显示高度超出部分隐藏css设置文本显示高度超出部分隐藏</div>
    </body>
</html>
Copy after login

Output results:

What is used to set text height in css3

(Learning video sharing: css video tutorial,html video tutorial)

The above is the detailed content of What is used to set text height in css3. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
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