2008-03
25

CSS 类选择器 派生定义的注意点

Write by Airene

.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定义样式时迷茫的人有点帮助。

Tags : css  
Class : Div+Css

 

  •   Kevlyn|  2012-01-08 03:27:59
  • I could read a book about this wtihout finding such real-world approaches!
  • 名字: *
  • 邮箱:
  • 网址:
  • 验码:
  • 内容:
   

i Categorys

CopyRight © 2008 - 2011 Airene.NET
Powered by ZhyoneBlog4j-1.0 京ICP备09069893号