Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS A question of Class's Reply To: A question of Class's

#235194
Alex Zaworski
Participant

Well, those selectors are actually totally different.

div.class {
   color:blue;
}

Will only, obviously, affect div elements. If you were to use .class instead, it will affect every element with the class.

It’s also a different level of specificity. Suppose you have the following:

div.class {
  color:red;
}
.class {
  color:blue;
}

The applied style will be color:red since the selector is more specific.

edit: Ah, was too slow