HTML:
<div id='container'>
<p>This is some text contained within a small-ish box. I'm using it as an example of how placing your floated elements in different orders in your HTML can affect your layouts. For example, take a look at this great photo placeholder that should be sitting on the right.</p>
<img src='image.gif'>
</div>
CSS:
#container {
width: 280px;
margin: 0 auto;
padding: 10px;
background-color: #aaa;
border: 1px solid #999;
}
p {
width: 100px;
}
img {
float: right;
}
Result: https://jsfiddle.net/y9Lqjm1f/
Why if the paragraph's width is small enough does the floated right element not appear at the top of the container div?