Rewind Rewind - 3 months ago 17
CSS Question

Multi Class in Html

I have a button with the following set of w3.css classes:



<link rel="stylesheet" href="http://www.w3schools.com/lib/w3.css">
<button class="w3-btn w3-lime w3-hover-green w3-round-large w3-border w3-border-green w3-ripple">Button</button>





This will be a common theme throughout my website. Instead of writing this list of all these classes on each and every button, how can I get this group of classes into a single class
mybuttonclass
like:

<button class="mybuttonclass">Button</button>

Answer

May be you can add a little bit of jquery, which might be a solution:

if ($('button').hasClass('mybuttonclass')) {
    $('button').removeClass('mybuttonclass'); //optional according to your theme requirements
    $('button').addClass('w3-btn w3-lime w3-hover-green  w3-round-large w3-border w3-border-green w3-ripple');
}