0

I have a little problem with jQuery UI at this time.

We use jQuery Accordions for our application and since our upgrade to jQuery UI 1.11.14 we experience a problem that causes any CSS we have written for Accordions to get overwritten by jQuery.

As far as I've understood this, jQuery UI activates itself after pageload and appends its styling. That leaves the question how I can add my own styling if jQuery always comes last. Any style inspectors shows that jquery-ui.min.css overwrites everything we have written before.

I know that !important exists but this is just bad practise and we want to avoid this or else we would append !important to about 20 rules or so which just looks terrible.

Edit: Here is a screenshot from IE's F12 Console: Here is a screenshot from IE's F12 Console http://puu.sh/lAoYJ/b3ed91b91c.png

1
  • Give the specificity. It also depends on what you are using. Commented Nov 27, 2015 at 10:21

1 Answer 1

1

Specificity matters a lot in CSS. Almost all the rules in jQuery UI do not use #ids. So that's a great advantage. ID takes higher precedence. So, when you wanna do something, for eg:

.col-md-5 {color: #f00;}

If this was already written in the bootstrap as:

.row .col-md-5 {color: #000;}

Then your code doesn't work. Give the body an id or a parent. So that way, you can target:

#id .col-md-5 {color: #f00;}

And that works well.

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

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.