Learn to code
Getting to Know CSS
- 选择器的的权重比位置更重要
type类型的权重是0-0-1,class的是0-1-0,id的是1-0-0
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<div class="hotdog">
<p>Yes</p>
<p>Yes</p>
<p class="mustard">Yes</p>
</div>
</body>
</html>
.hotdog p.mustard {
background: yellow;
}
.hotdog p{
background: brown;
}
网友评论