<!DOCTYPE html>
<html>
<head>
<style>
div p {
background-color: yellow;
}
</style>
</head>
<body>
<h1>Welcome to My Homepage</h1>
<div>
<h2>My name is Donald</h2>
<p>I live in Duckburg.</p>
</div>
<div>
<span><p>I will not be styled.</p></span>
</div>
<p>My best friend is Mickey.</p>
</body>
</html><span style="font-size:14px;">
</span>
在div p的情况下,I live in Duckburg和I will not be styled.的背景颜色变为黄色,只要在div之下的所有的p元素都会被选择
而在div>p的情况下,只有I live in Duckburg的背景颜色变为黄色!由此可见,只有直接指定的父元素的子元素才会被选择到,