Is empty css rule needed
I have the following H开发者_C百科TML:
<tr class="brand">.....
Depending on the user that is logged in, this "brand" class may not need to contain anything. So I have different styles sheets for different types of users.
User1.css:
.brand {
display: none;
}
User2.css:
.brand {
}
Do I actually need to bother setting the .brand rule in User2.css? Will it show up an invalid markup?
Thanks
No, you do not. An empty one will be evaluated the same as it not being there at all.
you do not need it. actually you should NOT have it, waste of space
There's nothing wrong in having another CSS file for custom rules if you really can't do otherwise.
Depending on your actual markup, the empty element could be not displayed, in this case you won't need the additional rule. But this is not always the case.
Alternatively you could put the different rules in the same file, just changing or adding a class to the html which will target the other rules, if you don't have excessive users.
You don't need to bother with an empty rule, it's not invalid but it's a waste of space and bandwidth. If you must specify a value, use display: table-tow;
.
精彩评论