直接把第九行的widtn改小点就好了,,其他人说的都是什么鬼。。造成无法显示原因就是宽度设置太大了,比如说宽度占了整个页面怎么居中都没用啊
.top{height:60px;margin:0 auto;background-color:gray;}
.main{height:400px;margin:0 auto;background-color:red;}
.left{height: 400px; float: left;width: 200px; background-color:blue;}
.right{height:400px; margin-left: 210px; width:100%; position: absolute;background-color: green;}
.main{height:400px;margin:0 auto;background-color:red;}
.left{height: 400px; float: left;width: 200px; background-color:blue;}
.right{height:400px; margin-left: 210px; width:100%; position: absolute;background-color: green;}
{height:100px;width:800px;background: #ccc;margin: 0 auto}
{height:500px;width: 800px;background: red;margin: 0 auto}
{height:500px;width:290px;background: blue;float:left}
{height:500px;width: 500px;background: greenyellow;float:right}
{height:50px;width:800px;background: orangered;margin: 0 auto}
{height:500px;width: 800px;background: red;margin: 0 auto}
{height:500px;width:290px;background: blue;float:left}
{height:500px;width: 500px;background: greenyellow;float:right}
{height:50px;width:800px;background: orangered;margin: 0 auto}
正解是在第9行加入,width:50%; margin:0 auto; 意思是宽度为总宽度的50%,上下宽度为0,两边自己适应宽度,也就是居中,但是在这个上面为什么没效果,是因为前面width设置了宽度960!!!这框架没那么TM的宽!前面的兄台们别误人子弟- - 要有效果,就这只width:50%。这基础,伤心啊
.top{height:50px;background:#ccc;margin:0 auto;}
.main{width:100%;height:500px;background:red;}
.left{width:40%;height:500px;background:blue;float:left;}
.right{width:58%;height:500px;background:green;float:right;}
.foot{width:100%;height:50px;background:orange;margin:0 auto;clear:both;}
完美!
.main{width:100%;height:500px;background:red;}
.left{width:40%;height:500px;background:blue;float:left;}
.right{width:58%;height:500px;background:green;float:right;}
.foot{width:100%;height:50px;background:orange;margin:0 auto;clear:both;}
完美!
最新回答 / 慕saber
<!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-...
2016-08-16