How to find second p (p tag) element in a div ( div Tag)

How to find second <p> element in a <div>

You could use the nth-child selector, set to find the second child. This will select all <p> elements that are the second child of their parent:

p:nth-child(2) {
  background-color: lightblue;
}

Leave a Comment