Try it here

How To Override One CSS Class With Another


If you want to add custom style to an object that already has it's style defined by other css class, sometimes you will have to replace some styles. Here's how to do it:

Firstly, check which class overrides it.
Let's say your markup returns:

<div class="range-specific range"></div>

If your css is defined like that:

.range-specific { foo; }

.range { bar; }

Then the range will win.

If you change it to:

.range-specific.range { foo; }
.range { bar; }

Then the specific will win.

If you want to hack it even more, do this:

.range-specific.range-specific { foo; }
.range { bar; }

And specific will surely win.

It's even better to do this:

.range { bar; }
.range-specific { foo; }

Writer profile pic

Uk01 on Nov 25, 2015 at 12:12 am

If you like and would like to contribute, you can write your article here or mail your article to . See your article appearing on the main page and help others to learn.

Post Comment

Comments( 0)


Forgot Password

Please enter your email address below and we will send you information to change your password.