from: http://www.brainjar.com/css/positioning/default.asp
Box:
1. Margins are always transparent.
2. Background settings aplly to padding and content areas.
3. The width and height of each box is equal to the width and height of the outer margin box.
4. The browser window serves as the root box.
5. There are two basic types of boxes: block( generated by elements such as p/div/table
) and inline( generated by tags such as b/i/span
and actual content like text and images).
6. In normal flow, block boxes flow vertically starting at the top of theire containing block, inline boxes flow horizontally from left to right.
7. If you set the disply
to none
, no box is created. The browser acts as if the element did not exist.
Flow:
1. There three positioning models: normal, float and absolute.
2. In normal flow, vertical margins are collapsed. Horizontal margins are never collapsed.
3. position: relative has no influnce on other blocks except for it's children, it just move itself to some offset.
4. Floated boxes are always treated as block boxes, even if they are defined using inline elements.
5. If position
is set as absolute
or fixed
, the element is removed from the normal flow and have no effect on boxes in the flow.
6. For relative positioning, offsets are measured from the element's "should-have-been" position in the normal flow, an absolutely positioned element is offset from its container block (has a position of absolute/relative/fixed
).