1.作用:
!important作用于css样式中,使其渲染优先级最高。
2.写法:
写在需要作用的样式后面:color:#3e5!important;
3.样例:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
.hack{color:#e35;}
.important{color:#3e5!important;}
</style>
</head>
<body>
<div class="hack important" style="color:#35e;">hello,world</div>
</body>
</html>
4.分析:
正常情况:显示的是#35e;
使用!important:显示的是#3e5;
5.另外IE6无法识别,其他的都可以识别。可以用来区分IE6.