码迷,mamicode.com
首页 > 其他好文 > 详细

宽度自适应布局

时间:2014-11-19 12:32:03      阅读:129      评论:0      收藏:0      [点我收藏+]

标签:style   io   ar   os   sp   on   div   bs   ef   

solution1、

宽度自适应的元素放在上面。

<div id="box">

  <p id="right">右侧</p>

</div>

固定宽度元素放在下面

<div id="left">左侧</div>

<style>

  #box{float:left;width:100%;height:400px;}

    #right{margin-left:200px;}

  #left{float:left;width:190px;margin-left:-100%;height:400px}

</style>

------------------------------------------------------------------------------------------------------------------------------------------

solution2

<div id="left">左侧</div>

<div id="box">

  <p id="right">右侧</p>

</div>

 

<style>

  #left{float:left;position:relative;width:190px;height:400px;margin-right:-190px;}

  #box{float:right;width:100%}

    #right{margin-left:200px;}

</style>

 

宽度自适应布局

标签:style   io   ar   os   sp   on   div   bs   ef   

原文地址:http://www.cnblogs.com/yaodi/p/4107884.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!