Xiao Peng

My personal blog moves to xiaopeng.me , blogs about design patterns will be synced to here.
肖鹏,ThoughtWorks资深咨询师,目前关注于架构模式、敏捷软件开发等领域,并致力于软件开发最佳实践的推广和应用。
多次为国内大型企业敏捷组织转型提供咨询和培训服务,在大型团队持续集成方面具有丰富的经验。
  博客园  :: 首页  :: 联系 :: 订阅 订阅  :: 管理

About CSS Box-Model and Flow

Posted on 2011-02-11 14:59  勇敢的鸵鸟  阅读(176)  评论(0编辑  收藏  举报

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