CSS CSS Selectors Advanced Selectors :nth-of-type

Nabil Nazeer
Nabil Nazeer
5,271 Points

How would we use these selectors if we had anchor elements nested inside list element?

1 Answer

Kevin Gates
Kevin Gates
14,796 Points

If I understand your question, it would be as simple as this:

li:nth-of-type(4) a {
  background: #52bab3;
  color: white;
}
Nabil Nazeer
Nabil Nazeer
5,271 Points

Yes, you did understand my question. Thanks a lot for your help.

Kevin Gates
Kevin Gates
14,796 Points

Nabil Nazeer You're welcome.

Would you mind marking the answer as "Best Answer" so it can more easily benefit other students as well?

Thanks!