CSS基础学习之路–02派生选择器!

派生选择器

  通过依据元素在其位置的上下文关系来定义样式
  
index.html

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link href="demo.css" type="text/css" ref="stylesheet">
</head>
<body>
<!-- blue -->
<p><strong>Hello JhonRain</strong></p>
<ul>
<!-- red -->
<li><strong>li标签:Hello Css</strong></li>
</ul>
</body>
</html>

demo.css

1
2
3
4
5
6
li strong{
color:red;
}
strong{
color:blue;
}

最后更新: 2018年09月26日 12:01

原始链接: http://yoursite.com/2016/03/09/CSS/CSS派生选择器/

× 请我吃糖~
打赏二维码