最新回答 / Chuan_wei
这个案例是不定宽水平居中!没有设置width属性所以不能使用margin:0 auto;案例要求是:使main水平居中在浏览器中央,并不是严格意义上的mian居中。当然了,如果真的要居中的话可以设置body宽度,在设置left,right的宽度,使得main的位置就是body的正中间位置
2016-03-21
已采纳回答 / ganqibaoqi
第一个错误:main 里面 width:100vw?? 改正:可以去掉第二个错误:left设置一个高度 改正:hight:600px;第三个错误:right设置一个高度 改正 hight:600px;搞定!!!!!
2016-03-21
已采纳回答 / Even_hui
1.clear: both 的用处就是,清除上方元素“浮动导致高度坍塌”(容器高度为0)。2. 清楚了 clear: both 是用来清除浮动之后: 加入 #footer 上方的元素是设置了 float,或者 #footer 上方的元素的子元素设置了 float,导致高度坍塌,#footer 就会被上方的元素 遮盖了,导致 #footer 显示不出来
2016-03-20
.top{height:100px; background:#ccc}
.main{height:400px; background:red; position:relative}
.left{ position:absolute; height:400px; width:125px; top:0; left:0; background:blue}
.right{position:absolute; height:400px; width:240px; margin-left:130px; background:#9c9}
.foot{height;50px; background:#f63}
.main{height:400px; background:red; position:relative}
.left{ position:absolute; height:400px; width:125px; top:0; left:0; background:blue}
.right{position:absolute; height:400px; width:240px; margin-left:130px; background:#9c9}
.foot{height;50px; background:#f63}