这些天一直在弄css相关的东西,一直都比较怕搞这个东西,做的很郁闷。以前跟一牛人聊天,说是觉得郁闷烦恼是好事儿,烦一段时间就好了,当你觉得做什么事儿都不烦的时候你就变得很牛了,真希望早点儿能变到那么牛。 言归正传,上一次有组织过一次css的培训,可没讲到什么重点的,提上去的问题也因为时间问题没有讲到,还是得自己慢慢琢磨。碰到的最搞人的问题就是IE6下,当容器大小设置为100%的时候,如果再设置padding,则容器会被撑开,因为这一点吃了不少苦头,经常是搞了几个小时都找不到问题所在,div是一层套一层,搞的人头晕。总结一下,就是IE6下padding会被算到容器大小中,而在IE7跟FF中则比较标准,padding不会被算到容器大小中,也可以在IE6中头部加一局xhtml的头信息,也能让IE6遵循上面的标准。另外一个问题就是position问题,详细解释见下表:
Value | Description |
static | Elements renders in order, as they appear in the document flow. This is default. |
absolute | The element is positioned relative to its first positioned (not static) ancestor element |
fixed | The element is positioned relative to the browser window |
relative | The element is positioned relative to its normal position, so "left:20" adds 20 pixels to the element's LEFT position |
inherit | The value of the position property is inherited from the parent element |
The key for absolute is "first positioned(not static)ancestor element" , this means the default positioned parent element will have no effect on the element.
Leave a Reply