What if you place the right
div before the middle
one ?
<div class="content">
<div class="left">
<p>Hi, Flo!</p>
</div>
<div class="right">foo</div>
<div class="middle">
<p>is</p>
<p>this</p>
<p>what</p>
<p>you are looking for?</p>
</div>
</div>
See your updated jsFiddle
To explain :
Using float
property is like using position:absolute
property. It gets the elements out of the DOM flow. Which means they do not take any space in it.
That's why you have to set a margin-left
property on the page content when using a float:left
div. If not, the content will be juste under the left div.
At the oposite, your middle
div is IN the DOM flow. So it takes all the space (because of his width AND his margin properties). So when you want to add your float:right
div, the next available space to do it is below the middle
div, and not anymore on the same line.
That's why, when you are using float
properties, you have to set them before the "not-floated" content.