[html] What is the use of style="clear:both"?

I happened to see a div which had the style clear:both! What is the use of clear in style?

<div style="clear:both">

This question is related to html css

The answer is


When you use float without width, there remains some space in that row. To block this space you can use clear:both; in next element.


Just to add to RichieHindle's answer, check out Floatutorial, which walks you through how CSS floating and clearing works.