HTML How to Make a Website Adding Pages to a Website Add Iconography

anthony amaro
anthony amaro
7,364 Points

targeting classes

does it makes any difference if we target the class like this.

.phone a {}

instead of targeting the class like in the video,

.contact-info li.phone a {}

is there any difference in targeting it with .phone a {}?

1 Answer

Adam Pengh
Adam Pengh
28,249 Points

The only difference is that the selector is more specific. For example, let's say you have an <li> element in the header with class .phone and a link inside, and the same thing in the footer. Using ".phone a" would select any link with a parent that has class .phone, but adding the .contact-info before would only select a "li.phone a" with a parent of ".contact-info".