当弹出警报框触发时,我有以下 html div 和 css。我希望它周围的其余屏幕变暗,但 CSS 不起作用。
我们可以只使用 css 使聚焦 div 周围的屏幕变暗吗?
.dim {
height:100%;
width:100%;
position:fixed;
left:0;
top:0;
z-index:1 !important;
background-color:black;
filter: alpha(opacity=75); /* internet explorer */
-khtml-opacity: 0.75; /* khtml, old safari */
-moz-opacity: 0.75; /* mozilla, netscape */
opacity: 0.75; /* fx, safari, opera */
}
<div class="dim" id="dialog" title="Event">
<p>
This is the default dialog which is useful for displaying information.
The dialog window can be moved, resized and closed with the 'x' icon.
</p>
</div>