<head>
<style>
.all{
float:left;
border:solid #000 2px;
}
#out{
border:solid #F00 2px;
height:100px;
}
#left{
width:10%;
height:100%;
}
#center{
width:80%;
height:100%;
}
#right{
width:10%;
height:100%;
}
</style>
</head>
<body>
<div id="out">
<div class="all" id="left"></div>
<div class="all" id="center"></div>
<div class="all" id="right"></div>
</div>
</body>
第1个回答 推荐于2016-03-12
给你个参考
.div1
{
float:left;
width:75px;
height:20px;
}
.div2
{
width:175px;
height:20px;
float:left;
}
div3
{
width:250px;
height:50px;
clear:both;
}
<div class="div1">我是第一个div</div>
<div class="div2">我是第二个div</div>
<div class="div3">我是第三个div</div>追问
.div1
{
float:left;
width:75px;
height:20px;
}
.div2
{
width:175px;
height:20px;
float:left;
}
div3
{
width:250px;
height:50px;
clear:both;
}
<div class="div1">我是第一个div</div>
<div class="div2">我是第二个div</div>
<div class="div3">我是第三个div</div>追问
我上面设置第一个是10%第二个80% 第三个10%,只要把其中一个小2%就没问题,我想问这是哪里的原因
追答页面元素之间有边距
边距会占用些像素
第2个回答 2012-09-06
既然没有帮助, 删掉了...