日期:2013-09-14  浏览次数:21142 次

一、三种款式选择器

属性选择器 p {color:red;}

类选择器 .p {color:red;}

ID选择器 #p {color:red;}

二、transparent

Background:transparent; 防止定义背景被覆盖

三、Netscape4.X(IE/WINDOWS4.0以前的版本)下错误的通明背景理解

Background:inhrit; 在netscape4.x下通明背景将被理解为黑绿

四、字体默认选择:

Body {font-family:”lucida Grande”,Verdana,Lucida,Arial,Helvetica,sans-serif; }

按顺序调用不同平台的默认字体

五、如何处理旧浏览器不支持CSS的情况

使用群选择器 例如:p,td,ul,ol,li,dl,dt,dd {font-size:small;}

六、使用netscape4敌对规则

Body {font-family:Verdana,sans-serif;}

p,td,ul,ol,li,dl,dt,dd {font-size:small;}

七、方法重载细节规则:

Body {font-family:Verdana,sans-serif;}

p,td,ul,ol,li,dl,dt,dd {font-size:small;}

p {font-family:times,”Times New Roman”,serif;}

八、内容(派生)选择器

Li strong {font-style:italic; font-weight:normal }

例如:strong {color:red;} h2{color:red;} strong h2 {color:blue;}

例如:#sidebar {color:red} #sidebar p {color:blue;}

例如:.fancy {color:red;} .fancy p {color:blue;} / li.fancy {color:black;}