1

Is it possible to group a bunch of classes into one for example:

 <button id="buttonCalculate" class="ui-btn ui-mini my-btn">Calculate</button>

It would be nice to group "ui-btn ui-mini my-btn" into a single class

Thanks

5
  • What is the purpose of it? Commented Jan 16, 2014 at 16:48
  • So that when you have to add or delete a class, you just do it in one place instead of search and replace. Commented Jan 16, 2014 at 16:49
  • You mean, with javascriptp or jQuery? Commented Jan 16, 2014 at 16:50
  • I guess they mean in their stylesheet as it's tagged with css. Please explain more? Commented Jan 16, 2014 at 16:51
  • Maybe this feature is not supported by css. But I still think it is a convenient thing to have. Commented Jan 16, 2014 at 16:54

3 Answers 3

1

Yes you can using CSS Mixins

Try reading this http://wynnnetherland.com/journal/css-mixins-vs-multiple-classes

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

Comments

0

Yes, you can group multiple classes in a single statement!

Like the one you're having!

<button id="buttonCalculate" class="ui-btn ui-mini my-btn">Calculate</button>

This is OK! And all the classes would be applied to it.

Comments

0

You can chain css if you want to apply properties to this element when all three classes are present.

.ui-btn.ui-mini.my-btn { }

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.