<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title> 页面名称 </title>
<style type="text/css">
.select2 em {
background-color: green;
color: blue;
}
#select1 + em {
color: red;
}
</style>
</head>
<body>
<div id="select1">
<strong class="select2">
<em>
aaaaaaaaaaaaa
</em>
</strong>
</div>
<em>
bbbbbbbbb
</em>
</body>
</html>
第一个空
.select2 em{background-color:green;color:blue}
第二个空
em{color:red}
‘字体颜色为红色’这几个字再用一个容器包着,然后给这个容器color:red;’不能改变我的颜色‘就会还是绿色
em:nth-child(1) {
background-color: green;
color: blue;
}
em:nth-child(2) {
color: red;
}