0

I have the following HTML:

<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

4 Answers 4

3

No, you do not. An empty one will be evaluated the same as it not being there at all.

Sign up to request clarification or add additional context in comments.

Comments

3

you do not need it. actually you should NOT have it, waste of space

Comments

1

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.

Comments

0

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;.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.