1

I want to load a css code from a specific stylesheet first, Like:

ul, ol {
    margin: 0 0 10px 25px;
    padding: 0;
}

the above code is in two files: core.css and bootstrap.css

core.css load first in head tag.

But browser always use code first from bootstrap.css.

I tried to rename bootstrap.css to z-bootstrap.css. But no luck still browser apply styles from z-bootstrap.css It work when I edit ul, ol to body ul, body ol in core.css

But I dont want to do this, How to apply styles from core.css without adding any class or attribute.???

4

4 回答 4

6

In your declaration, have core.css below/after bootstrap.css

example:

<link rel="stylesheet" type="text/css" href="bootstrap.css">
<link rel="stylesheet" type="text/css" href="core.css">
于 2013-04-19T14:33:05.247 回答
2

The order of css application does not always depend on the include order, but on the level of specificity:

http://www.w3.org/TR/CSS21/cascade.html#specificity

于 2013-04-19T14:35:59.257 回答
1

You need to load core.css after bootstrap.css in order for the rules in core to override bootstrap.

于 2013-04-19T14:33:13.713 回答
-3

Try to put !important at the end

ul, ol {
margin: 0 0 10px 25px !important;
padding: 0 !important;

}

That will give priority

于 2013-04-19T14:34:37.473 回答