0

Trying to select the first instance of an element of class 'vidplayicon' in each 'imgClass' div.

here is my HTML

<div class="imgClass">
  <div>
    <p>test</p>
  </div>
  <div>
    <p class="vidplayicon">test</p> <!-- this should be selected-->
  </div>
  <div>
    <p class="vidplayicon">test</p>
  </div>
</div>
...
<div class="imgClass">
  <div>
    <p class="vidplayicon">test</p> <!-- this should be selected-->
  </div>
  <div>
    <p class="vidplayicon">test</p>
  </div>
  <div>
    <p class="vidplayicon">test</p>
  </div>
</div>

and this is my CSS

.imgClass  div .vidplayicon:first-of-type{
    color:red;
}

but it's not working can I have some suggestions?

user2993497
  • 525
  • 1
  • 7
  • 21

1 Answers1

0

first-of-type it's suposed to be used with tag names, not classes.

Take a look at this thread.

Dionei Miodutzki
  • 657
  • 7
  • 16