We would like to know how to first-of-type; Select the first CSS element using a pseudo class.
<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.myClass:first-of-type {<!--from w ww .j av a 2 s . co m-->
background-color: #233423;
color: #FFFFFF;
}
</style>
</head>
<body>
<div class="myClass">
<p>First</p>
</div>
<div class="myClass">
<p>Second</p>
</div>
<div class="myClass">
<p>Third</p>
</div>
</body>
</html>
The code above is rendered as follows: