How to change the default background color white t

2020-05-18 08:40发布

I am building a web application where I have set my default color to navy blue using css. But when i added the twitter bootstrap css's in my page I did not find my navy blue color instead I found the white background color provided by twitter bootstrap.

My query is that what portion of css should I change in bootstrap to change my page's background.

9条回答
我想做一个坏孩纸
2楼-- · 2020-05-18 09:19

I'm using cdn boostrap, the solution that I found was: First include the cdn bootstrap, then you include the file .css where you are editing the default styles of bootstrap.

查看更多
beautiful°
3楼-- · 2020-05-18 09:27

I would not recommend changing the actual bootstrap CSS files. If you do not want to use Jako's first solution you can create a custom bootstrap style sheet with one of the available Bootstrap theme generator (Bootstrap theme generators). That way you can use 1 style sheet with all of the default Bootstrap CSS with just the one change to it that you want. With a Bootstrap theme generator you do not need to write any CSS. You only need to set the hex values for the color you want for the body (Scaffolding; bodyBackground).

查看更多
Emotional °昔
4楼-- · 2020-05-18 09:31

Its not recommended to overwrite bootstrap file, just in your local style.css use

body{background: your color !important;

here !important declaration overwrite bootstrap value.

| improve this answer | | | | |
查看更多
爷的心禁止访问
5楼-- · 2020-05-18 09:32

You can simply add this line into your bootstrap_and_overides.css.less file

body { background: #000000 !important;}

that's it

查看更多
劳资没心,怎么记你
6楼-- · 2020-05-18 09:32

The colors changed due to the order of CSS files.

Place the custom CSS under the bootstrap CSS.

查看更多
一纸荒年 Trace。
7楼-- · 2020-05-18 09:34

You can overwrite Bootstraps default CSS by adding your own rules.

<style type="text/css">
   body { background: navy !important; } /* Adding !important forces the browser to overwrite the default style applied by Bootstrap */
</style>
查看更多
登录 后发表回答