Home > Web Front-end > CSS Tutorial > How to hide excess text in css3

How to hide excess text in css3

WBOY
Release: 2021-12-08 16:02:14
Original
3308 people have browsed it

In CSS, you can use the overflow attribute to set the exceeded text to be hidden. This attribute is used to specify what happens when the content exceeds the element box. When the value of the attribute is "hidden", the exceeded content will be hidden, the syntax is "text element {overflow:hidden;}".

How to hide excess text in css3

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

How to hide the exceeded text in css3

In css, if you want to hide the exceeded text, you can use the overflow attribute, overflow Properties specify what happens when content overflows the element's box.

The attribute values ​​are as follows:

How to hide excess text in css3

The example is as follows:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style type="text/css">
            div{
                width:200px;
                height:50px;
                border:1px solid black;
                overflow:hidden;
            }
        </style>
    </head>
    <body>
        <div>超出隐藏超出隐藏超出隐藏超出隐藏超出隐藏超出隐藏超出隐藏超出隐藏</div>
    </body>
</html>
Copy after login

Output result:

How to hide excess text in css3

(Learning video sharing: css video tutorial)

The above is the detailed content of How to hide excess text 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