Floating DIVs, one absolute width other relative width?
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.
精彩评论