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

How to not display elements in css

coldplay.xixi
Release: 2023-01-05 16:08:58
Original
4888 people have browsed it

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>
Copy after login

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!

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