css_sduty/06_CSS复合选择器/04_子代选择器.html
2024-06-29 18:53:19 +08:00

34 lines
632 B
HTML

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>04_子代选择器</title>
<style>
/* 子代选择器 */
div>a {
color: red;
}
div.foot>a {
color: skyblue;
}
</style>
</head>
<body>
<div>
<a href="#">张三</a>
<a href="#">李四</a>
<a href="#">王五</a>
<p>
<a href="#">赵六</a>
<div class="foot">
<a href="#">孙七</a>
</div>
</p>
</div>
</body>
</html>