码迷,mamicode.com
首页 > Web开发 > 详细

css中display为none 和visibility为hidden的区别

时间:2014-11-21 15:45:14      阅读:127      评论:0      收藏:0      [点我收藏+]

标签:des   style   io   ar   color   os   sp   java   for   

区别一:
display:none
Turns off the display of an element (it has no effect on layout); 
all child elements also have their display turned off. 
//隐藏这个元素;所有的子元素也跟着他隐藏.
visibility:hidden
The box is invisible (fully transparent, nothing is drawn), but still affects layout.  
Descendants of the element will be visible if they have visibility:visible 
(this doesn‘t work in IE up to version 7).
//这个容器不可见(完全透明),但占有布局.后代(子)元素将会显示,如果设有visible属性
 
区别二:
display为none时,元素不占用页面流,就好像该元素不存在一样.
visibility为hidden时,仍然占用页面流,也就是这块区域虽然不可见,但是占据一块空间.

css中display为none 和visibility为hidden的区别

标签:des   style   io   ar   color   os   sp   java   for   

原文地址:http://www.cnblogs.com/ryanlamp/p/4112925.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!