float is used to take an element out from it's default placement and moved to the left or right side of the other content. This is often used to place images to the side of a block of content.

The image on the right uses float: right; to float to the right. The image also has a margin: 10px; to give it some space so it doesn't go right into the text.

If you using float on its own, elements will often float to the side of more content than you planned for. For example, here's how this page looked initially: The image was supposed to just be floating to the side of the content about float, but the next section ended up next to it as well! To prevent this from happening, use the CSS property clear. clear lets you clear an element to ensure that it stays below floating elements. It can be set to left, right or both to specify the side that you want to stay clear of.

For example, the second paragraph below uses the clear style to make sure it appears below the image

Have you noticed the difference between the placement of p (paragraph) elements and <b> (bold) elements?

Look at the following HTML and see how it's displayed right below:

This is a paragraph.

This is a bold paragraph.

The <b> element is rendered inline after the previous content, without creating a new block on the next line. Paragraphs however, form their own blocks that take up the whole width available with new lines before and after.

By default, the following elements are also block elements:

These elements are inline by default:
[null, {"document_url": "https://www.learneroo.com/modules/126/nodes/695", "unformatted_src": "https://s3.amazonaws.com/learneroo-images/main/Lynx_kitten.jpg", "src": "https://s3.amazonaws.com/learneroo-images/main/Lynx_kitten.jpg", "formatted_filename": "Lynx kitten"}, null, {"document_url": "https://www.learneroo.com/modules/126/nodes/695", "unformatted_src": "https://s3.amazonaws.com/learneroo-images/main/image-without-clear.png", "src": "https://s3.amazonaws.com/learneroo-images/main/image-without-clear.png", "formatted_filename": "image without clear", "rendered_width": "80%;"}, null]