在CSS中,讓元素隱藏(指屏幕範圍內肉眼不可見)的方法不少,有的佔據空間,有的不佔據空間;有的能夠響應點擊,有的不能響應點擊。下面一個個列出,選 一個適合你的web
{ display: none; /* 不佔據空間,沒法點擊 */ }orm
{ 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);
/* 不佔據空間,沒法點擊 */
}ci