nth child for class
<!DOCTYPE html>
<html>
<head>
<style>
/* Selects the second element of div siblings */
.out > :nth-child(1) .myclass {
background: red;
}
.out > :nth-child(2) .myclass {
background: green;
}
.out > :nth-child(3) .myclass {
background: yellow;
}
</style>
</head>
<body>
<div class="out">
<div>
<div>
<div class="myclass">
<p>This is some text.</p>
</div>
SOME
</div>
SOME 2
</div>
<div>
<div>
<div class="myclass">
<p>This is some text.</p>
</div>
SOME
</div>
SOME 2
</div>
<div>
<div>
<div class="myclass">
<p>This is some text.</p>
</div>
SOME
</div>
SOME 2
</div>
</div>
</body>
</html>