用css制作有滚蛋条的弹出框剧中,在滚动滚动条是不闪

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>有滚蛋条的弹出框剧中</title>
<style>
*{ padding:0px; margin:0px; }
body,html{height:100%; 100%;}
html{overflow:hidden;}
body{overflow-y:auto }
.display{ 
position:absolute; 
left:50%; top:50%; 
height:300PX; 
500PX; 
margin-left:-250PX; 
margin-top:-150PX; 
border:1PX solid #F00;}
</style>
</head>
<body>
<DIV style="height:2000PX;">测试滚动</DIV>
<DIV style="height:2000PX;">测试滚动</DIV>
<DIV style="height:2000PX;">测试滚动</DIV>
<div class="display"></div>
</body>
</html>

但要注意的必须声明网页的解析模式,如果用js去实现,在滚动条滚动的时候弹出框会闪

原文地址:https://www.cnblogs.com/tongchuanxing/p/2598967.html