1.讓一個塊元素充滿整個螢幕:
.mode{
width: 400px;
height: 300px;
background-color: green;
position: fixed;
top:50%;
left: 50%;
margin-left: -200px;
margin-top: -150px;
z-index: 1;
}
.shaddow{
position: fixed; #這樣對話框的input就不能操作了 因為 z-index比shaddow小
top:0; #這是塊元素視窗全覆寫代碼
left: 0;
bottom: 0;
right: 0;
background-color: black;opacity: 0.6; #透明度
z-index: 8; #莫泰對話框
}
<div class="shaddow">
<input type="text">
<input type="text">
<input type="text">
<input type="text">
<input type="text">
</div>
<div class="mode"> </div>