上次在写“JS打造div遮罩层霸屏广告”中,由于ad_bg这个id使用了绝对定位,导致在各个分辨率下显示不完美,因此浩叔将功补过,修改了另一个给大家用,下面就是完整html代码,里面的图片大家自己替换哈!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>div遮罩层弹窗——示例二</title> <style type="text/css"> #ad_show { height: 550px; width: 1000px; border: 5px solid #999; margin: 3% auto; z-index: 50; position: relative; background-color: #FFF; } #ad_show #win_top a { float: right; margin-right: 5px; } #ad_bg { background-color:#000; position:absolute; z-index:49; width:100%; height:100%; opacity:0.6; filter: alpha(opacity=60); -moz-opacity: 0.6; left: 0px; top: 0px; right: 0px; bottom: 0px; } #close{position: absolute; right:0; top:0; cursor: pointer;} </style> </head> <body> <div id="ad_bg"></div> <div id="ad_show"> <div id="close"><img src="close.png" onclick="ad_bg.style.display='none';ad_show.style.display='none'" width="50"></div> <div class="content"><img src="index_ad.jpg"></div> </div> </body> </html>
转载请注明: haoshu发表于浩叔逛逛>>https://www.haoshu888.com/js/290.html