Float and clear

Float and clear are considered two of the most problematic CSS instructions, but they wouldn't have to. Float lets you specify whether an element can accept other elements around its area or not; and clear lets you specify which elements are not going to accept other elements around its area, without exceptions.

Clear accepts left, right, both and none as possible alternatives. Float accepts left, right or none.

The trick to use these CSS instructions properly is to use them scarcely. On Heptagrama, we have assigned a float: right to every picture on the site, for instance. If you want your site to have a fixed footer at the end of each of its web pages, the easier thing to do is not to try to achieve this positioning that area, but just placing it at the bottom of the web page's code and then include clear: both in its respective CSS.

We are going to expand this part of the tutorial in a short future.


Knowledge + Computers