开发者

one liquid div with one fixed size div

开发者 https://www.devze.com 2022-12-21 02:42 出处:网络
I am trying to build a layout which has a fixed width div and a liquid width div beside it : <div id=\"main\" style=\"width:100%; height:500px; background-colo开发者_开发问答r: #ccc;\">

I am trying to build a layout which has a fixed width div and a liquid width div beside it :

<div id="main" style="width:100%; height:500px; background-colo开发者_开发问答r: #ccc;">
    <div id="right" style="float: right; width:100px; height:500px; background-color: red;">
    </div>
    <div id="left" style="float: right; width: auto; height:500px; background-color: orange;">
    </div>
</div>

the left div is not filling its width, also i want this div to fill whole main div when right div is not present, how can i do it ?


I think what you want is more like

<div id="main" ... >
  <div id="right" style="float: right; width: 100px;"> Will take up 100 px </div>
  <div id="left" style="margin-right: 100px;"> Will take up the rest </div>
</div>
0

精彩评论

暂无评论...
验证码 换一张
取 消