Home  >  Article  >  Web Front-end  >  How to not display elements in css

How to not display elements in css

coldplay.xixi
coldplay.xixiOriginal
2021-04-15 17:07:134847browse

How to set non-display elements in css: 1. Use the [display: none;] method; 2. Change [display:none;] to [visibility: hidden;]

How to not display elements in css

The operating environment of this tutorial: windows7 system, css3 version, DELL G3 computer.

How to set non-display elements in css:

(1) display: none;

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <style type="text/css">
    .box {
        width: 160px;
        height: 100px;
        background: #cad5eb;
    }
    .title {
        height: 40px;
        background: #54a962;
    }
    .content {
        height: 60px;
        background: #5650bb;
    }
    </style>
</head>
<body>
    <div class="box">
        <h3 class="title">标题</h3>
        <p class="content">内容</p>
    </div>
</body>
</html>

How to not display elements in css

Settings display: none;The effect after display is as follows

How to not display elements in css

It can be seen that the original title part is missing, and the content part occupies the original title part

( 2) visibility: hidden;

It’s still the above example, but this time change display:none; to visibility: hidden; but the result is quite different

How to not display elements in css

The above is the detailed content of How to not display elements in css. 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