手机
当前位置:查字典教程网 >网页设计 > Div+Css教程 >CSS如何让背景不能滚动
CSS如何让背景不能滚动
摘要:最近学习点样式表,以前有一位很历害的CSS朋友给我这个代码,看的挺不错的,思想真棒!留个纪念!无标题文档*{margin:0;padding...

 最近学习点样式表,以前有一位很历害的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>

【CSS如何让背景不能滚动】相关文章:

DIV+CSS垂直居中一个浮动元素

CSS代码如何实现条状图表形式

CSS怎么将背景图左移/上移/右移10px

CSS中几种常见的注释

怎样用CSS实现大背景网页效果

CSS制作网页总结的一些经验

CSS设置DIV背景色渐变显示

CSS改变文字被选择时的背景颜色

CSS3制作loading加载动画效果代码

CSS让ul所有的li居中显示的方法

上一篇: CSS层叠顺序
精品推荐
分类导航