案例:jquery案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<style>
5
.descendants *
6
{ 
7
display: block;
8
border: 2px solid lightgrey;
9
color: lightgrey;
10
padding: 5px;
11
margin: 15px;
12
}
13
</style>
14
<script src="/js/jquery-1.11.1.min.js">
15
</script>
16
<script>
17
$(document).ready(function(){
18
  $("div").children().css({"color":"red","border":"2px solid red"});
19
});
20
</script>
21
</head>
22
<body>
23
24
<div class="descendants" style="width:500px;">div (当前元素) 
25
  <p>p (子)
26
    <span>span (孙)</span>     
27
  </p>
28
  <p>p (child)
29
    <span>span (孙)</span>
30
  </p> 
31
</div>
32
33
</body>
34
</html>
35