About CSS Box-Model and Flow

來源:互聯網
上載者:User

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).

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.