Anthony Liriano
Anthony Liriano

Reputation: 599

why use div.classname instead of just .classname

Why use div.classname instead of just .classname

.classname{
   color: red;
}
div.classname{
   color: red;
}

Upvotes: 1

Views: 52

Answers (1)

sjm
sjm

Reputation: 5468

A higher specificity means a higher priority

i.e. the properties of div.classname{} would override properties specified in .classname{} and target only Div elements

Upvotes: 4

Related Questions