文章詳情頁
javascript - position fixed;設(shè)置了height 100 卻不是瀏覽器可視窗口的寬高,求大神釋疑。
瀏覽:72日期:2023-04-17 10:07:39
問題描述
設(shè)置了如下css樣式的代碼,但是顯示的高度不是全屏,如圖。
.ss_hide{ position: fixed; background: rgba(0,0,0,.2); height: 100%; width: 100%;}
問題解答
回答1:建議全屏使用
top: 0;bottom: 0;left: 0;right: 0;回答2:
看一下你body和html所占的大小是否全屏。或者高100vh寬100vw
回答3:還得加上 top:0;left:0;
回答4:絕對定位脫離文檔流了吧 既然都絕對定位了 top:0;left:0;right:0;bottom:0; 剛好覆蓋屏幕
標(biāo)簽:
JavaScript
排行榜

熱門標(biāo)簽