twitter-bootstrap 如何编辑引导程序样式?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/43380030/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 00:46:03  来源:igfitidea点击:

How to edit bootstrap styles?

csstwitter-bootstrap

提问by dtechlearn

how can I edit bootsrap style like body background color?

如何编辑 bootsrap 样式,如身体背景颜色?

I dont want to do this all the time:

我不想一直这样做:

body { background: #539754 !important; }

I want to set font color in navbar but i cannot do that. I am preety confused about where the styles are coming from

我想在导航栏中设置字体颜色,但我不能这样做。我对样式的来源感到困惑

.navbar-default .navbar-nav > li > a {
 color: #000;
 font-size: 20px;
 font-family: cursive;
 }
 .navbar-default .navbar-nav > li > a:hover,
 .navbar-default .navbar-nav > li > a:focus {
 color: #333;
 background-color: transparent;
 }

I did this inside bootstrap.css but Nothing happened. when pressing F12 edit it there in file /dist/css/bootstrap.css - I dont even have that folder. I understand its created dynamickly but how can I edit it?

我在 bootstrap.css 中做了这个,但什么也没发生。按 F12 时在文件 /dist/css/bootstrap.css 中编辑它 - 我什至没有那个文件夹。我理解它是动态创建的,但我该如何编辑它?

回答by Adrianopolis

To override bootstrap styles you create your own stylesheet such as styles.css and be sure to load it after your bootstrap css file. When defining the classes just match or exceed bootstraps tree. Example: If bootstrap is defining:

要覆盖引导程序样式,您可以创建自己的样式表,例如 styles.css,并确保在引导程序 css 文件之后加载它。定义类时,只需匹配或超过引导树。示例:如果引导程序正在定义:

.navbar-default .navbar-nav > li > a {
     color: #000;
     font-size: 20px;
     font-family: cursive;
 }

and all you want to do is change color you add this to your new stylesheet.

您要做的就是更改颜色,将其添加到新样式表中。

.navbar-default .navbar-nav > li > a {
     color: #CC0000;
 }

回答by Ulug Toprak

Add a class to your <li>tag like

将一个类添加到您的<li>标签中,例如

class="diff-color"

Then add rules to your css file

然后将规则添加到您的 css 文件中

.diff-color{
    color:blue;
}