<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<!-- ul.list>li{item$}.item*8 -->
<ul class="list">
<li class="item">item1</li>
<li class="item second">item2</li>
<li class="item">item3
<!-- ul.inner>li{itm3-$}*3 -->
<ul class="inner">
<li>itm3-1</li>
<li>itm3-2</li>
<li>itm3-3</li>
</ul>
</li>
<li class="item">item4</li>
<li class="item">item5</li>
<li class="item">item6</li>
<li class="item">item7</li>
<li class="item">item8</li>
</ul>
<style>
/*
空格 后代元素,
> 子元素
+ 相邻兄弟
~ 所有兄弟
*/
.list>li{
border: 1px solid #000;
}
.list li{
border: 1px solid #000;
}
.item.second{
background-color: red;
}
.item.second + * {
border: 2px solid yellow;
}
.item.second ~ * {
border: 2px solid yellow;
}
</style>
</body>
</html>