作用:提升属性的权重,其值为无穷大。
格式:
属性:值 !important;
注意:
1、!important提升的是属性的权重,而不能提升选择器的权重
2、!important不能提升继承过来的权重
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>!important属性</title>
<style>
div{
color:green !important;/*!important不能提升继承过来的权重 这里还是显示蓝色*/
}
p{
color:red ;
font-size: 20px ;
}
.p1{
color:blue;
font-size: 100px;
}
</style>
</head>
<body>
<div>
<p class="p1">大吉大利</p>
</div>
</body>
</html>