css 小记

定位

position:

    static : 按文档流输出

    relative: 其实是 relative to self 的文档流进行 偏移(left, top, 设置偏移)(元素显示偏移了,但在文档中还是占用那个空间)

    absolute: 脱离文档流,相对 自己的已定位祖父元素的偏移(left, top) (元素显示偏移了,而且在文档中不占用空间)

    fixed: 脱离文档流, 真正的绝对定位,相对文档窗口定位.(元素显示偏移了,而且在文档中不占用空间)

 

使用 relative, absolute, fixed定位的元素就是 已定位的元素, body是顶层已定位元素。

 


clear: left, right, both, none

 

Box Model

    六种盒子: 内联, 内联块, 块, 表格, 绝对定位,浮动。

  display: inline (内联盒子), block(块盒子), inline-block(内联块盒子)

    position: absolute, fixed.    (绝对定位盒子)

    float: left, right, both, none (浮动盒子)

 

    margin, border, padding, overflow, width, height, left, top.

 

    inline box: width,height和overflow不起作用。

 

选择符:

tagname #id

selector[attribute="value"]

.classname  selector:pesudo-class  *.classname.subclass 

selector:pesudo-object

selector 空白符 descendent_selector

selector > child_selector

selector+sibling-selector

 

posted @ 2010-08-31 11:15  napoleon_liu  阅读(144)  评论(0编辑  收藏  举报