3

I am using jquery autocomplete and would like to override some of the css styles used in it but I am not able to do so. The input font size is 1 em and the font:weight is bold which I don't want. so how do I change the font size and font weight.

here are the css classes that I want to change. I put all font sizes to 0.5 em but it is not chaniging anything.

            /* Component containers
            ----------------------------------*/
            .ui-widget {
                font-family: Verdana,Arial,sans-serif;
                font-size: 0.5em;
            }
            .ui-widget .ui-widget {
                font-size: 0.5em;
            }
            .ui-widget input,
            .ui-widget select,
            .ui-widget textarea,
            .ui-widget button {
                font-family: Verdana,Arial,sans-serif;
                font-size: 0.5 !important;
            }
            .ui-widget-content {
                border: 1px solid #aaaaaa;
                background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x;
                color: #222222;
            }
            .ui-widget-content a {
                color: #222222;
            }
            .ui-widget-header {
                border: 1px solid #aaaaaa;
                background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x;
                color: #222222;
                font-weight: bold;
            }
            .ui-widget-header a {
                color: #222222;
            }

2 Answers 2

9

First try avoiding using !important in your code as it is a bad practice.

Next you are missing the em suffix after the units

font-size: 0.5 !important;
              ^-------------Missing em

should be

font-size: 0.5em !important;
                     ^------- get rid of this

You always have the option of overriding the styles if you can calculate the specificity properly.

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

1 Comment

Thanks for that link to the article about specificity. It was very helpful.
1

Try this:

.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button {
    font-size: 0.5em !important;
    font-weight:normal !important;
}

If it didn't work please make a fiddle.

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.