CSS显示之间的差异:无;和可见性:隐藏;
CSS显示:无;
display:none属性用于隐藏元素而不删除它们。它不占用任何空间。
<!DOCTYPE html>
<html>
<head>
<style>
h3 {
display: none;
}
</style>
</head>
<body>
<h2>This heading is visible</h2>
<h3>This is a hidden heading</h3>
<p>The hidden heading does not take up space even after hiding it since we have used display: none;.</p>
</body>
</html>CSS可见性:隐藏;
可见性:hidden属性也隐藏元素,但会影响布局,即占用空间。让我们看一个例子
<!DOCTYPE html>
<html>
<head>
<style>
h3 {
visibility: hidden;
}
</style>
</head>
<body>
<h2>This heading is visible</h2>
<h3>This is a hidden heading</h3>
<p>The hidden heading takes up space even after hiding it.</p>
</body>
</html>热门推荐
1 带狗狗训练
4 听力训练狗狗
6 怎训练狗狗
7 腹肌训练狗狗
8 网球训练狗狗
9 记叙文训练狗狗
10 狗狗太凶怎么训练
11 核心力量训练狗狗
12 狗狗乱叫怎么训练
13 发音训练狗狗
14 怎么训练狗狗叼东西给主人
15 荆州训练狗狗
16 篮球训练狗狗
17 做训练狗狗
18 训练狗狗坐姿