twitter-bootstrap Twitter Bootstrap 背景颜色/容器颜色

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13499974/
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-21 15:45:42  来源:igfitidea点击:

Twitter Bootstrap Background Color/Container Color

twitter-bootstrapbackground-color

提问by Nick Latocha

I have a bootstrap theme for my WordPress site and I'm trying to recreate the theme in another page.

我的 WordPress 网站有一个引导程序主题,我正在尝试在另一个页面中重新创建该主题。

www.bleep.io/blog

www.bleep.io/blog

The theme has a grey background but the container div is white - giving the impression of a grey border.

主题背景为灰色,但容器 div 为白色 - 给人一种灰色边框的印象。

I've tried to recreate this by setting the body background color and the container background to white. But this turns the nav-bar white too.

我试图通过将主体背景颜色和容器背景设置为白色来重新创建它。但这也会使导航栏变白。

Any ideas how I do this?

任何想法我如何做到这一点?

回答by Jeremy John

Hi there from what you are saying you want to have a white background same as the twitter bootstrap css design but you can't change the body to white.

你好,你说的是你想要一个与 twitter bootstrap css 设计相同的白色背景,但你不能将主体更改为白色。

So you need to find this code as your body has a class added to it's tag, find for this in your page template (should be just before the <body>tag):

所以你需要找到这段代码,因为你的身体有一个类添加到它的标签中,在你的页面模板中找到它(应该在<body>标签之前):

<style type="text/css" id="custom-background-css">
body.custom-background { background-color: #d4d4d4; }
</style>

that is what you are looking for to change the background color.

这就是您要更改背景颜色的方法。

EDIT:

编辑:

Try finding and changing this:

尝试查找并更改此内容:

.container {
background-color: #D4D4D4;
margin: 0px auto;
padding-right:24px;
padding-left:24px;
}

and this:

还有这个:

<style>
body {
padding-top: 60px; 
}
</style>

Please also check your css file on the page http://www.bleep.io/contact.htmlas it's a broken link and it may be the cause of that:

还请检查页面上的 css 文件,http://www.bleep.io/contact.html因为它是一个损坏的链接,可能是导致此问题的原因:

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

回答by W. Shawn Wilkerson

You should probably refrain from editing the main bootstrap files. Additional files are provided for you to perform customizations. Look for the main.css and the main.js files in the appropriate directory locations.

您可能应该避免编辑主引导程序文件。提供了其他文件供您执行自定义。在相应的目录位置中查找 main.css 和 main.js 文件。

This will help prevent a total breakage on the site, and should be easier to fix and troubleshoot if the need arises.

这将有助于防止站点完全损坏,并且在需要时应该更容易修复和排除故障。

This is of course for these types of minor changes. If you are creating an entire theme: go for it.

这当然是针对这些类型的小改动。如果您正在创建一个完整的主题:去吧。