CSS Float Left Example
Posted on 10. Jan, 2010 by CSSFloat in Examples
Here’s an example of using CSS Float to float an item left.
The square below with a blue border is a div tag aptly named “floatleftexample”.
In order for the blue square to float left of this text, the floatleftexample div must be above this paragraph in the html code.
Float Left Code
Let’s start with the CSS code. This can be placed between style tags or in an external stylesheet.
.floatleftexample {float: left; width: 320px;}
That’s it! Pretty simple eh? Remember to include a width to make the CSS valid.
and the html code…
<div class=”floatleftexample”>Contents of the blue square</div>
<p>Text to the right of the Blue square.</p>
