<script type="text/javascript"> $(function(){ $('#divLocker').css({ "position": "absolute", "margin-left": 0, "margin-top": 0, "background": "rgba(0, 0, 0, 0.8)", "height": function(){ return $(document).height();}, "width": function(){ return $(document).width();}, "overflow": "hidden", "z-index": "999" }); }); </script> <body> <div id="divLocker" style="display: none;">我是内容</div> 内容部分需要屏幕居中显示 <div id="payInterface" style="margin: auto; position: absolute; left: 0; right: 0; top: 0; bottom: 0; text-align: center; <?=$w?>px; height: <?=round($w*0.9*357/420, 2)?>px;"><img src="http://www.cnblogs.com/images/pay.png" alt="" width="90%" /></div>