body{ margin:0; padding:0; font-size:30px; font-weight:bold}
div{ text-align:center; line-height:50px}
.main{ width:960px; height:600px; margin:0 auto}
.left{ width:300px; height:600px; background:#ccc;float:left;}
.right{ width:640px; height:600px; background:#FCC;float:right;}
</style>
div{ text-align:center; line-height:50px}
.main{ width:960px; height:600px; margin:0 auto}
.left{ width:300px; height:600px; background:#ccc;float:left;}
.right{ width:640px; height:600px; background:#FCC;float:right;}
</style>
.top{width:auto;height:200px;background:gray;}
.main{width:auto;background-color:red;height:800px;}
.left{width:200px;float:left;background:blue;height:800px;position:absolute;}
.right{width:80%;float:right;background:green;height:800px;margin-left: 10%;!importan}
.foot{height:80px;width:auto;}
.main{width:auto;background-color:red;height:800px;}
.left{width:200px;float:left;background:blue;height:800px;position:absolute;}
.right{width:80%;float:right;background:green;height:800px;margin-left: 10%;!importan}
.foot{height:80px;width:auto;}
margin:0px 310px 0px 210px;
这句话的作用是设置了绝对定位属性的元素会脱离文档流,既不在文档中占有位置,那么center中的文字内容就会占据左右以及中间元素本来的位置,那么设置左右外边距(边距会出现合并现象,所以要超出左右元素的宽度)就会压缩center里的文字,使其出现换行,并不在占用左右元素的位置,这样解释对不对,求大神指点
这句话的作用是设置了绝对定位属性的元素会脱离文档流,既不在文档中占有位置,那么center中的文字内容就会占据左右以及中间元素本来的位置,那么设置左右外边距(边距会出现合并现象,所以要超出左右元素的宽度)就会压缩center里的文字,使其出现换行,并不在占用左右元素的位置,这样解释对不对,求大神指点
.top{height:50px;width:100%;background:gray;}
.main{height:600px;width:100%;background:red;position:relative;}
.left{ width:200px;height:600px;background:blue;position:absolute;top:0;}
.right{height:600px;background:green;margin-left:210px;}
.foot{width:100%;height:50px;background:orange;}
.main{height:600px;width:100%;background:red;position:relative;}
.left{ width:200px;height:600px;background:blue;position:absolute;top:0;}
.right{height:600px;background:green;margin-left:210px;}
.foot{width:100%;height:50px;background:orange;}
浮动方法(参数大概,重要方法)
.left{height:600px;width:15%;background:red;float:left;}
.main{height:600px;width:65%;background:green;float:left;margin:0 2.5% 0 2.5%;}
.right{height:600px;width:15%;background:blue;float:right;}
.left{height:600px;width:15%;background:red;float:left;}
.main{height:600px;width:65%;background:green;float:left;margin:0 2.5% 0 2.5%;}
.right{height:600px;width:15%;background:blue;float:right;}
.top{width:100%;height:100px;background:gray;position:relative}
.main{width:100%;height:400px;background:red;top:0px;}
.left{ width:200px;height:400px;float:left;background:blue;}
.right{width:702px;height:400px;float:right;background:green;}
.foot{clear:both;background:orange;}
.main{width:100%;height:400px;background:red;top:0px;}
.left{ width:200px;height:400px;float:left;background:blue;}
.right{width:702px;height:400px;float:right;background:green;}
.foot{clear:both;background:orange;}