I'm trying to create a layout with CSS and ran into the the following issue.
I have two divs, displayed side by side (one is floated left), wrapped in a third div. This works fine.
What I want to be able to do is have one div have free height (adjusted to content) and I want the other div to never be larger than this. So for example, if the first div is 3 lines of text and the second is 4 lines, the second should go into overflow. But I don't want to give a fixed value to the height of the first div or the wrapper.
How would I go about having CSS do this?
EDIT: I've created a Fiddle of what I have so far, if that helps anyone. I decided to not use float here and instead went for an absolute position + margin so the area under the left div would stay cleared.
So what I want here is for blue to be the same height as red (with overflow turning on if I enable it), but without having to set the height of anything to a fixed number.
HTML:
<div class="wrapper group">
<div class="left">Lorem ipsum dolor sit amet, vide porro ubique vis ei.</div>
<div class="right">Probo fabulas inermis cu cum. Eros voluptatibus vel te, ea sea velit quaestio consectetuer, modus facete no qui. Has eu quidam salutandi dissentiunt, his sanctus voluptatibus ei. Has lorem complectitur te, in per adipisci gloriatur dissentiunt. E</div>
</div>
CSS:
.left {
display: block;
background-color: red;
width: 10em;
position: absolute;
}
.right {
margin-left: 10em;
display: block;
background-color:blue;
}
.wrapper {
width: 100%;
border-style: solid;
border-color: yellow;
}
EDIT: I created a version with float too.
.left {
float: left;
display: block;
background-color: red;
width: 10em;
}
.right {
margin-left: 10em;
display: block;
background-color:blue;
}
.wrapper {
width: 100%;
border-style: solid;
border-color: yellow;
}
.group:after {
display: table;
clear: both;
content:"";
}