I want to have two divs side by side and define width for only one div.
Then, the other div would auto-fit the parent container. How do I do that?
HTML:
<div class="parent">
<div class="first"></div>
<div class="last"></div>
</div>
CSS:
.parent {
width: 100%;
}
.parent .first {
width: 300px;
float: left;
background-color: red;
}
.parent .last {
width: auto;
float: right;
background-color: blue;
}
Thanks.
Don't float
the second div. Only the first one needs to be floated.
http://jsfiddle.net/zLef8/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With