Home > Web Front-end > HTML Tutorial > The difference between display:none; and visibility:hidden;_html/css_WEB-ITnose

The difference between display:none; and visibility:hidden;_html/css_WEB-ITnose

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-24 11:46:30
Original
1268 people have browsed it

如果想让某一段代码在前台不显示,最简单的方法是用css的display:none即可,这样下边的内容就自动上移或右侧的左移来填补这个空隙。但特殊情况下我们只需要隐藏这个元素,

但它的位置不能被占了,那该怎么实现呢?接下来我们来看css的另外一个属性Visibility属性。

visibility:隐藏对应的元素但不挤占该元素原来的空间。
display:隐藏对应的元素并且挤占该元素原来的空间。

 

来看看下面的这个例子:

XML/HTML代码

 

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