我一直在使用!important的特异性。显然#sid更具体(100),我使用!important,但是即使P元素样式的特异性较低(001),P元素样式也会胜过它。
<head>
<style>
#sid
{
color:red !important;
}
p
{
color:green;
}
</style>
</head>
<body>
<section class="sclass" id ="sid">
<p class="pclass" id="pid">
Why It is green!! clearly sid is more specific (specificity rule and !important trumps all)
</p>
</section>
</body>
</html>