3

This might be a dumb question, but I couldn't find an answer by searching here or with Google. I've been doing web design a few years now, but in some code at work I noticed this:

.header-silver,
.header-silver,
.header-silver,
.header-silver {
    #gradient >.vertical(#FEFEFE, #E1E1E1);
}

I didn't write this, but as far as I know, using the same class like that is very redundant. Is there something I've missed in my quest in learning CSS/LESS, and there a chance that the person that wrote this used it for a reason?

2 Answers 2

3

The class wrapper .header-silver is redundant.

My previous notion on the #gradient is wrong as ScottS mentioned below. I missed the part where it is a mixin call and not a style.

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

3 Comments

That's what I thought. Thanks for clearing that up. And you're probably right about the #gradient, but I'll check it out just in case.
I agree that it is redundant with respect to the multiple .header-silver calls. I disagree that it is "redundant completely as an ID is used" because that is not what the code #gradient >.vertical(#FEFEFE, #E1E1E1); is doing. In LESS syntax, that is a call to a namespaced mixin in the #gradient namespace. So the CSS code for .header-silver is being generated through the mixin called inside the #gradient namespace. The #gradient is not part of the selector string in relation to .header-silver, and thus it is not redundant on that account.
@ScottS you're totally right! My apologies, I wasn't paying enough attention.
2

Nope, just the one .header-silver will work fine.

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.