在CSS中,样式规则以级联方式应用于元素。下面这个列表中越靠前的权重越小:
●浏览器样式:是Web浏览器声明的默认样式。
●用户声明的样式:是用户使用浏览器选项设置或通过开发人员调试工具修改的自定义样式。
●开发中声明的样式:是网站开发人员在CSS样式表中声明的样式。
●具有!important规则的开发者声明样式。
●具有!important规则的用户样式。
!important规则的使用示例:
<!DOCTYPEhtml>
<html>
<head>
<metacharset="utf-8">
<title>php中文网(php.cn)</title>
<style>
#container{
width:450px;
height:200px;
font-size:25px;
}
#example{
color:red!important;
}
#container#example{
color:pink;
}
</style>
</head>
<body>
<divid="container">
<divid="example">PHP中文网!</div>
</div>
</body>
</html>


本文转载自中文网
本文转载自中文网
如需转载,请注明文章出处和来源网址:http://www.divcss5.com/css3-style/c56204.shtml