开发者

Floating DIVs, one absolute width other relative width?

开发者 https://www.devze.com 2023-01-23 15:31 出处:网络
There is probably a simple answer, but I can\'t seem to figure it out. Code: <body> <div class=\'left\'>

There is probably a simple answer, but I can't seem to figure it out.

Code:

<body>
  <div class='left'>
  </div>
  <div class='right'>
  </div>开发者_Go百科
</body>

I want .left to be width:100px and .right to be the remaining width of <body>, but for the life of me, I can't get it.

I have:

<style>
.left{
 float:left;
 width:100px;
}
body{
 width:100%;
 height:100%;
}
.right{
 float:left;
 width:85%;
}
</style>

But of course 85% won't fill <body>. Any suggestions? I know it's simple.


.right { margin: 0 0 0 100px; } /* remove the float and width */

This will not work if you have elements inside .right which clear, otherwise it will.

0

精彩评论

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