子类选择器和后代选择器

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>子类选择器和后代选择器</title>
</head>
<body>
	<div id="father">
		<div>11</div>
		<div>22
			<p>111</p>
			<p>222</p>
			<p>333</p>
		</div>
		<div>33</div>
		<div>44</div>
		<div>55</div>
		<p>66</p>
		<p>77</p>
		<p>88</p>
	</div>
	<script src="jquery-1.12.4.js"></script>
	<script>
		$(function(){
			// $("s1,s2")//并集选择器
			// $("s1 s2")//后代选择器
			// $("s1>s2")//子带选择器
			// $("li.green")
			// $("s1s2")//交集选择器
			$("#father p").css("backgroundColor","red");
		});
	</script>
</body>
</html>

  

猜你喜欢

转载自www.cnblogs.com/luwn/p/12705414.html