萬盛學電腦網

 萬盛學電腦網 >> 網頁制作 >> DivCSS教程 >> CSS如何讓背景不能滾動

CSS如何讓背景不能滾動

 最近學習點樣式表,以前有一位很歷害的CSS朋友給我這個代碼,看的挺不錯的,思想真棒!留個紀念!

<!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=gb2312" />
<title>無標題文檔</title>
<style type="text/css">
*{ margin:0; padding:0;}
html,body{ width:100%; height:100%; overflow:auto; position:relative;}
.container{ width:100%; height:100%; overflow:auto;}
.bg{ background:#000000;opacity:0.5; filter:alpha(opacity=50); position:absolute; z-index:1; overflow:auto; width:100%; height:100%; left:0; top:0;}
.box{ position:absolute; left:50%; top:50%; width:300px; z-index:11; height:300px; line-height:300px; color:#f60; font-weight:bold; font-size:20px;}
.info{ position:absolute; left:-50%; top:-50%; z-index:10; width:300px; height:300px; text-align:center; border:1px solid #f00; background:#fff;}
</style>
</head>

<body>
<div class="container">
<script type="text/javascript">
for(var i=0;i<150;i++){
document.write('<center>大力開發建設蝶戀蜂狂就愛上了開發簡單說了開發經理的薩克減肥啦可適當加分</center>');
}
</script>
</div>
<div class="bg"></div>
<div class="box"><div class="info">我就不動</div></div>

</body>
</html>

copyright © 萬盛學電腦網 all rights reserved