Reputation: 15091
I am curious to know the usage of the div.something
in CSS. I have seen this around the Internet but don't know what it really means when people use div.
following by some class without gaps. What is it?
div.report {
background:pink;
}
This seems the same thing like .report { .. }
so why would some one use div.report
Upvotes: 0
Views: 90
Reputation: 887415
In case you also have <span class="report">
.
Or, simply to clarify to people reading the CSS what elements will have that class.
Upvotes: 1
Reputation: 60527
div.report
means that only div
elements with the class of report
will be selected. .report
on the other-hand will select any element with report class, be it a div
, p
, span
, etc.
Additionally, div.report
is more specific than .report
, so properties in the former will override properties in the later.
Upvotes: 3
Reputation: 30416
This CSS rule matches div
elements with the class report
. If you omitted the div then it would match any element with the class report
.
Upvotes: 1