class样式优先级问题

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>class优先级</title>
	<style>
		div{
			width:100px;
			height:100px;
			margin:20px;
		}
		.lik_2{
			background:green;
		}
		.lik_1{
			background:red;
		}
	</style>
</head>
<body>
	<div class="lik_1 lik_2"></div>
	<div class="lik_2 lik_1"></div>
</body>
</html>

  样式只与style中的先后顺序有关,而与body中元素的class顺序无关。

posted @ 2017-07-07 12:53  likwin  阅读(807)  评论(0编辑  收藏  举报