-
给元素设置浮动或者绝对定位,这就是脱离文档流布局
查看全部 -
.left{ width:200px; height:600px; background:#ccc; position:absolute; left:0; top:0} .main{ height:600px; margin:0 310px 0 210px; background:#9CF}(magin上右下左,顺时针) .right{ width:300px; height:600px; position:absolute; right:0; top:0; background:#FCC;}
查看全部 -
<!DOCTYPE html> <html> <head> <title>css之一列布局</title> <style type="text/css"> body{ margin:0; padding:0; } .top{ width:1400px; height:35px; background:grey; } .main{ width:600px; height:400px; background-color:red; margin:0 auto; } .foot{ width:600px ; height:200px; background-color:blue; margin:0 auto; } </style> </head> <body> <div class="top"></div> <div class="main"></div> <div class="foot"></div> </body> </html>查看全部
-
三列布局 .left{ width:200px; height:600px; background:#ccc; position:absolute; left:0; top:0} .main{ height:600px; margin:0 300px 0 200px; background:#9CF} .right{ height:600px; width:300px; position:absolute; top:0; right:0; background:#FCC;查看全部
-
三列布局 .left{ width:200px; height:600px; background:#ccc;position:absolute; left:0; top:0} .main{ height:600px; 【任务2】 background:#9CF} .right{ height:600px; width:300px; position:absolute; top:0; right:0;查看全部
-
text-align:center(让文字内容居中) line-height:50px(文字内容50像素)
查看全部 -
.top{height:100px;width:100%;background:gray;}
.main{width:800px;height:900px;background:yellow;}
.left{width:200px;height:900px;background:blue;position:absolute;left:0;top:100px;}
.right{width:600px;height:900px;background:green;margin-left:210px;}
.foot{height:100px;background:orange;}
查看全部 -
margin:0 auto上下距离为0,查看全部
-
.left{ width:200px; height:600px; background:#ccc; position:absolute; left:0; top:0} .main{ height:600px; margin:0 310px 0 210px; background:#9CF}(上右下左,顺时针) .right{ width:300px; height:600px; position:absolute; right:0; top:0; background:#FCC;}
查看全部 -
<div>放在<body>结尾处需要清除浮动:clear: both
查看全部 -
绝对定位代码为position:absolute;left:o;yop:0;
顶右底左;
查看全部 -
自适应设宽度时需要设百分比,浮动需要设float,固定宽度的设像素px,
查看全部 -
margin:0 auto 设置对象上下间距为0,左右自动
查看全部 -
<!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=utf-8" />
<title>混合布局编程挑战</title>
<style type="text/css">
body{ margin:0; padding:0; font-size:30px; color:#fff}
.top{height:100px;background: grey;}
.main{height: 800px;background: red;}
.left{width: 33.2%;height: 800px;background: blue;float: left;}
.right{width: 66.4%;height: 800px;background: green;float: right;}
.foot{height: 50px;background: orange;}
</style>
</head>
<body>
<div class="top">top</div>
<div class="main">
<div class="right">right</div>
<div class="left">left</div>
</div>
<div class="foot">foot</div>
</body>
</html>
查看全部 -
<!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=utf-8" />
<title>三列布局</title>
<style type="text/css">
body{ margin:0; padding:0; font-size:30px; font-weight:bold}
div{ line-height:50px}
.left{ width:200px; height:600px; background:#ccc; position:absolute; left:0; top:0}
.main{ height:600px; margin:0 310px 0 210px; background:#9CF}
.right{ height:600px; width:300px; position:absolute; top:0; right:0; background:#FCC;}
</style>
</head>
<body>
<div class="left">left</div>
<div class="main">设计首页的第一步是设计版面布局。就象传统的报刊杂志编辑一样,我们将网页看作一张报纸,一本杂志来进行排版布局。 虽然动态网页技术的发展使得我们开始趋向于学习场景编剧,但是固定的网页版面设计基础依然是必须学习和掌握的。它们的基本原理是共通的,你可以领会要点,举一反三。</div>
<div class="right">right</div>
</body>
</html>
查看全部
举报