CSS Selector :first-of-type
Description
The :first-of-type
selector selects every element that is the first child of a particular type from its parent.
This is the same as :nth-of-type(1)
.
Example
<!DOCTYPE html>
<html>
<head>
<style>
p:first-of-type{<!--from w ww .j a v a2 s .c o m-->
background:gray;
}
</style>
</head>
<body>
<p>The first paragraph.</p>
<p>The second paragraph.</p>
<p>The third paragraph.</p>
<p>The fourth paragraph.</p>
</body>
</html>
The code above generates the following result.