ol>li 이렇게 하면 ol의 바로 밑에 있는 li에 대해서만 선언이 적용된다
#lecture>li라고 하면 id값이 lecture인 선택자 바로 밑에 있는 li에 대해서만 선언이 적용된다
<!DOCTYPE html>
<html>
<head>
<style>
ul li{
color:red;
}
#lecture>li{
border:1px solid red;
}
ul,ol{
background-color: powderblue;
}
</style>
</head>
<body>
<ul>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ul>
<ol id="lecture">
<li>HTML</li>
<li>CSS
<ol>
<li>selector</li>
<li>declaration</li>
</ol>
</li>
<li>JavaScript</li>
</ol>
</body>
</html>
A+B
A~B
A
댓글