Floating is a concept of making elements flying around the web page, constrained to the space provided by their parent elements. The general trick used are to float the elements left, or right. When an element is asked to float right, it tries to fly to the maximum position it can reach to it's right, without being blocked by any other elements that may be in it's path. This comes handy when we need to split pages to form skeletal structures.
The simplest form of a float trick, involves 2 steps.
- Define the width of the element.
- Float it "right", or "left".
CSS code
HTML code
Sample output

There is a small problem however with this approach. Elements containing floating children don't consider the height of their children. It is therefore required to "clear" both sides at the end of all the child elements.
0 comments:
Post a Comment