2 divs, 100% minus 250px width is possible?

I have 2 divs that have full height, one on the left and one on the right, one on the right should have a width of 250 pixels, the one on the left should fill the remaining area (liquid).

Can this be done? If only the width: 100% - 250 pixels; worked ?? // ">

+3
source share
1 answer

Just swim 250px one to the right and give one that extends the right edge of 250px.

<div class="right">
    Some right content
</div>
<div class="main">
    Some main content
</div>
.right {
    width: 250px;
    float: right;
}
.main {
    margin-right: 250px;
}​

See jsFiddle.

This will not expand their heights to be the same if one is larger than the other, but I think that you have already covered, no?

+3
source

All Articles