
How to apply !important using .css()?
1 Expert Answer

Gabriel F. answered 11/25/19
Full Stack Software Developer and Mentor
Hi there. In general, !important declarations should be used sparingly so having one declaration overriding the other probably means it is time to revise your css. If you want to keep the current css you need to add more specificity to the selector whose rules you want to prevail, otherwise those rules won't be applied. Something like this (may need less selector but this gives you an idea):
I hope this helps.
Still looking for help? Get the right answer, fast.
Get a free answer to a quick problem.
Most questions answered within 4 hours.
OR
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.
Steven S.
Instead of overriding the style, could you use jQuery to remove the styles you don't want and add the new ones? Not sure if this will work without seeing what is going on exactly.04/02/19