2
<link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet"/>

If I use this .css file in my code, it will overlap the previous .css files which I wrote myself, how can i load my .css files first, if I can not find the css then turn to the bootstrap .css file?

amphetamachine
  • 27,620
  • 12
  • 60
  • 72

4 Answers4

2

i would guess that your css declaration looks like this

<link rel="stylesheet" type="text/css" href="yourcss.css" />
<link rel="stylesheet" type="text/css" href="bootstrap.css" />

you should change them upside-down

<link rel="stylesheet" type="text/css" href="bootstrap.css" />
<link rel="stylesheet" type="text/css" href="yourcss.css" />

the reason is that any css that is closer to the body tag, will be considered the first priority. if items in yourcss.css has the SAME NAME with the items your bootstrap.css, the bootstrap.css's items will be OVERRIDDEN. if you didn't want to override these, make sure the item/class/id name is different for each in the yourcss.css. Make the best practice of giving each tag a different class name for your css.

0

You write your css files like this:

<link rel="stylesheet" type="text/css" href="style/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="style/your-style.css" />
rish
  • 215
  • 1
  • 2
  • 15
0

try this

<link rel="stylesheet" href="assets/css/bootstrap.css">

after your own css

<link rel="stylesheet" href="assets/css/YOURCSS.css">
Gökalp Demirbağ
  • 108
  • 1
  • 2
  • 7
0

You could load your own CSS with

<link rel="stylesheet" type="text/css" href="css/style.css" />

and then import bootstrap inside your own CSS file, that way your CSS will be on top of bootstrap and you will be able to override it.

@import url("bootstrap.css");
dafilipaj
  • 1,064
  • 14
  • 24