child selector

There is also a more useful selector sub-selector, that is, the greater than symbol (>), which is used to select the first-generation child elements of the specified label element. For example, the code in the code editor on the right:

.food>li{border:1px solid red;}

This line of code will add a red solid border to the sub-element li (fruits, vegetables) under the class name food.


Continuing Learning
||
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<style type="text/css">
.food>li{border:1px solid red;}/*1px 线*/
</style>
</head>
<body>
<p class="first"><span><span></span></span
    >
    </p>
<h1></h1>
<ul class="food">
<li>
<ul>
<li></li>
<li></li>
<li></li>
</ul>
</li>
<li>
<ul>
<li></li>
<li></li>
<li></li>
</ul>
</li>
</ul>
</body>
</html>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
submitReset Code
图片放大关闭