0
我嘗試把一個div 100%的頁面內容的頂部。問題出現在內容有一定餘量時。我在這裏用一個簡化的例子來說明。頂部100%
如果我明白,位置固定:「該元素相對於瀏覽器窗口定位」。那麼,爲什麼div .trans會受到背後的影響?如何把div透明100%的頁面和內容的頂部?
這裏就是看這個問題,並嘗試解決方案的好地方:http://jsfiddle.net/rdkAW/1/
CSS:
body { margin:0; }
.trans{
position:fixed;
width:100%; height:100%;
margin:0;
opacity:0.7; filter: alpha(opacity = 70);
background-color:red;
z-index:5;
}
#content {
position:relative;
margin:30px auto; /* is this the problem? */
width:95%; max-width:890px; height:1200px;
z-index:1;
background-color:blue;
}
HTML:
<div class="trans"></div>
<div id="content"></div>