2008-03
25
CSS 类选择器 派生定义的注意点
-

- Author : Airene
- Tags : css
- Class : Div+Css
.fanne td {
color: #f60;
background: #666;
} 使用方法举例:<table class=fanne><tr><td></td></tr></table> 这样TD里就有上面的属性了;
td.fanne {
color: #f60;
background: #666;
} 使用方法举例:<table><tr><td class=fanne></td></tr></table> 这样TD里就有上面的属性了;
PS:注意第二个样式中没有空格;
#header{...} #header #haha{...} 这个是haha的定义内容 同时 haha样式也‘继承’了header的所有属性;
#header, #haha{...}这个就是header和haha同时定义一样的属性了;注意区别。
常见的还有#header ul li{...} 这里的li的样式只有在header容器里才能生效了 也是说别的地方的li还是默认的样子。希望对CSS定义样式时迷茫的人有点帮助。





Categorys
Friends