我在位置固定的div內創建了疊加,因爲我想使用從網站最頂端開始的幻燈片效果來顯示它。已修復位置的疊加並不顯示div內的所有內容
這裏是CSS代碼:
.overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.75);
z-index: 9999;
color: white;
display: inline-block;
height: 1040px;//as example
}
的問題是,不覆蓋格內的所有內容所示。我也嘗試插入一個溢出:auto,但它不起作用。
這裏是例子:
demo
疊加的含量太大,位置固定的方式正是:固定的,因此不能滾動,如果視口太小。 – Paul
您不能使用'position:fixed',因爲一旦應用,覆蓋層與「父」div沒有任何關係。所有定位等現在都與視口...和視口相關。 –