0

I'm loading my css after jQuery Mobile's css file:

<head>
    <link rel="stylesheet" href=".../1.1.1/jquery.mobile-1.1.1.min.css" />
    <link rel="stylesheet" href="main.css" />
</head>

But my margin attribute always get overwritten:

firebug showing overwritten margin attribute

Is jquery's css getting loaded dynamically after mine somehow? I've tried using ThemeRoller but it is too simple, I can't change the margins.

Thanks!

1 Answer 1

2

The reason why your CSS is getting overwritten is because the jQuery's CSS is more accurate with its selectors.

You say that all items with class .ui-radio should have margin, which is taken first, then all items with .ui-radio that are inside .ui-controlgroup-vertical have a set margin too.

A simple trick would be to make sure to use the same selector, .ui-controlgroup-vertical .ui-radio in this case, this should do the trick if your CSS is loaded after. Else, use one more parent container and you will be fine.

Little read to make it clearer: http://www.w3.org/wiki/CSS/Training/Priority_level_of_selector

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.