6

I feel like this is a silly question but I always find that modifying certain CSS attributes to be a hassle when working with jQuery. Let's say I define an element as a jQuery-UI object (like autocomplete or the datepicker) how do I go about modifying the CSS without having to go on the UI site and building my own theme?

For example, I find that the default font-size of the calendar to be pretty big so I often have to find the containing div created by jQuery and then add a font-size: 14px !important; if I want the style to be applied or else it gets trumped by the jQuery definition (since it's a lot more selective).

Is the solution making my rules more selective or am I missing something really obvious?

1
  • 2
    I sympathize. I honestly respect jQuery UI but I think it's a really bad solution for a lot of sites exactly because of the layout it imposes. What I've done is just taken the CSS they gave me and freely modified it. A lot. I really don't want my site to look like a "jQuery UI site" anyway, and I have no regrets :-) Commented Jul 20, 2010 at 14:20

1 Answer 1

10

I have not used JQuery-UI, but a quick look at their documentation seems to indicate that a lot of styling should be simple to override. This page http://jqueryui.com/docs/Theming/API talks about your particular example of font-size, stating that the .ui-widget class controls the font-size for a particular widget. So it seems like for you to get your font size, you would just need to have some css that does this:

#ui-datepicker-div.ui-widget {font-size: 14px}

Hope that helps.

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

2 Comments

Wow great link, thanks! I always looked in the css that comes with the download and it always seems like they have a mile-long selector so I figured it was so much more complicated than this :)
The page linked above has gone now (in 2014), try here: api.jqueryui.com/theming/css-framework

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.