DIV布局一行三列
<divclass="main"> <divclass="left"> &nb...
<div class="main"> <div class="left" > </div> <div class="mid"> </div> <div class="right" > </div> </div> 怎么写CSS样式,能让这三个层在同一行显示,并且左右两个层的宽为5PX,中间的层的宽度随屏幕大小改变。 我试过很多方法,可以让三个层在同一行显示,但是中间的层不能随屏幕大小改变
展开
展开全部
<style>
#main{ width:100%; overflow:hidden;}
.left,.right{ float:left; width:5px; height:400px; background:#F00;}
.right{ float:right; background:#0F0;}
#middle{ float:left; display:inline-block;height:400px; background:#FF0; padding:0px 20px;}
</style>
<div id="main">
<div class="left"></div>
<div class="right"></div>
<div id="middle">
中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层
</div>
</div>
</body>
</html>
这样差不多可以
#main{ width:100%; overflow:hidden;}
.left,.right{ float:left; width:5px; height:400px; background:#F00;}
.right{ float:right; background:#0F0;}
#middle{ float:left; display:inline-block;height:400px; background:#FF0; padding:0px 20px;}
</style>
<div id="main">
<div class="left"></div>
<div class="right"></div>
<div id="middle">
中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层中间层
</div>
</div>
</body>
</html>
这样差不多可以
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询