Reputation: 9657
Suppose I have the following css rule:
.blah { Rules }
and I use it as such
<div class="blah">
Now suppose, somewhere in my doc I need to add margin-bottom: 10px
to one of these divs with class name blah so I can make it as specific as possible,
Should I declare it as
.blah.mar-bot-blah { margin-bottom: 10px; }
or
.blah .mar-bot-blah { margin-bottom: 10px; }
to use it as <div class="blah mar-bot-blah">
Upvotes: 2
Views: 263
Reputation: 92793
Declare it as:
.blah.mar-bot-blah { margin-bottom: 10px; }
It will match elements that have both the classes .mar-bot-blah
and .blah
.
Upvotes: 5
Reputation: 111
If you want to make it really specific, I would use your first solution. (Warning: IE6 Can't handle this!)
In most cases it should suffice to just use .mar-bot-blah { margin-bottom: 10px; } so you can re-use this setting in other classes as well.
Upvotes: 1