I'm facing a simple layout issue here - trying to align two divs next to each other. Image on the left, text on the right. However, when the text is too long, it pushes the div down instead of wrapping around. I want the cs-summary div to automatically wrap text and stay in place:
http://jsfiddle.net/csaltyj/5Huau/
Code:
<div class="container">
<div class="cs-image">
<img src="http://www.electroniccampus.org/school_logos/CFNC/Wake_Forest_University/Wake_Forest_University2.jpg" />
</div>
<div class="cs-summary">
<p>Texty text text McTexterson likes to text. Why is div getting shoved down?</p>
</div>
</div>
<div class="container">
<div class="cs-image">
<img src="http://www.electroniccampus.org/school_logos/CFNC/Wake_Forest_University/Wake_Forest_University2.jpg" />
</div>
<div class="cs-summary">
<p>Super short text behaves.</p>
</div>
</div>
CSS:
.container {
overflow: hidden;
border: 2px solid #0f0;
width: 400px;
margin-bottom: 1em;
}
.cs-image {
float: left;
border: 2px solid red;
}
.cs-summary {
font-size: 0.8em;
border: 2px solid blue;
float: left;
margin-left: 1em;
}
In the second container example below, you can see that short text works fine. I don't want to set fixed width values for the text, but rather have it adjust its size accordingly.
Appreciate any help with this. Thanks!