直接举例说明
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8" />
<title>引号</title>
<style>
.box, .box2{ border:1px solid #dedede; width:2100px; height:200px; text-align:center}
.box h1:first-child{color:red}
.box h2:first-child{color:blue}
.box h3:first-child{color:green}
.box2 h1:first-of-type{color:red}
.box2 h2:first-of-type{color:blue}
.box2 h3:first-of-type{color:green}
</style>
</head>
<body>
<div class="box">
<h1>H1</h1>
<h2>H1</h2>
<h3>H1</h4>
</div>
<div class="box2">
<h1>H1</h1>
<h2>H1</h2>
<h3>H1</h4>
</div>
</body>
效果
从图片上可以很明显的发现,first-child 只对其父元素的第一个子元素 起作用, 而first-of-type对其父元素下同类型子元素中的第一个 起作用