网站制作学习网DIV+CSS→正文:css设置页面满屏的代码
字体:

css设置页面满屏的代码

DIV+CSS 2010/6/29 12:15:45  点击:不统计

forasp.cn

查看效果:css设置页面满屏的代码

第一种设置:
<style type="text/css">
*{ margin:0; padding:0;}
div{ height:200px;}
#warp{ width:100%; position:relative;}
#content{ background-color:#000099; margin-right:200px;}
#sider{ width:200px; top:0; right:0; position:absolute;background-color:#666666;}
</style>

第二中设置:
<style type="text/css">
*{ margin:0; padding:0;}
div{ height:200px;}
#warp{ width:100%;}
#content{ float:left; width:100%; background-color:#000099; margin-right:-200px;}
#sider{ width:200px;  background-color:#666666;float:right;}
</style>

body中的div设置为
<body>
<div id="wrap">
 <div id="content"></div>
    <div id="sider"></div>
</div>
</body>

第一种没有浮动,第二种有浮动,且在第二种中content距右边为负200px,而不是200px,如果设成200px的话,页面就会出现横向滚动条,相当于页面加宽了200px


·上一篇:css zoom属性 >>    ·下一篇:HTML colgroup 标签 >>
推荐文章
最新文章