您现在的位置是:网站首页> 编程资料编程资料
CSS中如何让元素隐藏?_资源网
                     2023-12-05
                418人已围观
                
                2023-12-05
                418人已围观
            
简介 CSS中如何让元素隐藏?_资源网
在CSS中,让元素隐藏(指屏幕范围内肉眼不可见)的方法很多,有的占据空间,有的不占据空间;有的可以响应点击,有的不能响应点击。下面一个个列出,选一个适合你的
{ display: none; /* 不占据空间,无法点击 */ }
 { visibility: hidden; /* 占据空间,无法点击 */ }
 { position: absolute; top: -999em; /* 不占据空间,无法点击 */ }
 { position: relative; top: -999em; /* 占据空间,无法点击 */ }
 { position: absolute; visibility: hidden; /* 不占据空间,无法点击 */ }
 { height: 0; overflow: hidden; /* 不占据空间,无法点击 */ }
 { opacity: 0; filter:Alpha(opacity=0); /* 占据空间,可以点击 */ }
 { position: absolute; opacity: 0; filter:Alpha(opacity=0); /* 不占据空间,可以点击 */ }
 {
 zoom: 0.001;
 -moz-transform: scale(0);
 -webkit-transform: scale(0);
 -o-transform: scale(0);
 transform: scale(0);
 /* IE6/IE7/IE9不占据空间,ie8/firefox/Chrome/Opera占据空间。都无法点击 */
 }
 {
 position: absolute;
 zoom: 0.001;
 -moz-transform: scale(0);
 -webkit-transform: scale(0);
 -o-transform: scale(0);
 transform: scale(0);
 /* 不占据空间,无法点击 */
 }
 
                                
                                                         
                                
                                                         
                                
                                                         
 
    