Bootstrap Rails - 更改背景颜色,不起作用?

时间:2014-02-14 07:43:57

标签: css ruby-on-rails ruby-on-rails-3 twitter-bootstrap

我已经基于RailsTutorial构建了一个Ruby on Rails站点。我试图改变一些颜色,但我无法弄明白。

我想更改背景颜色[页面主体]和菜单文本的颜色。我在哪里可以做到这一点?

我当前的custom.css.scss:

@import "bootstrap";

/* mixins, variables, etc. */

$grayMediumLight: #eaeaea;

@mixin box_sizing {
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}

/* universal */

html {
  overflow-y: scroll;
}

body {
  padding-top: 60px;
}

section {
  overflow: auto;
}

textarea {
  resize: vertical;
}

.center {
  text-align: center;
  h1 {
    margin-bottom: 10px;
  }
}
table td {
  padding:0px 25px 0px 0px;
}
table th {
  text-align: left;
  padding:0px 25px 0px 0px;
}



/* bootstrap */

.navbar-inner {
  background-color: white; /* background color will be black for all browsers */
  background-image: none;
  background-repeat: no-repeat;
  filter: none;
}


/* typography */

h1, h2, h3, h4, h5, h6 {
  line-height: 1;
}

h1 {
  font-size: 3em;
  letter-spacing: -2px;
  margin-bottom: 30px;
  text-align: center;
}

h2 {
  font-size: 1.2em;
  letter-spacing: -1px;
  margin-bottom: 30px;
  text-align: center;
  font-weight: normal;
  color: $grayLight;
}

p {
  font-size: 1.1em;
  line-height: 1.7em;
}
p2 {
  font-size: 1.1em;
  line-height:1.7em;
  font-weight: bold;
}

/* header */

#logo {
  float: left;
  margin-right: 10px;
  font-size: 1.7em;
  color: black;
  letter-spacing: -1px;
  padding-top: 9px;
  font-weight: bold;
  line-height: 1;
  &:hover {
    color: white;
    text-decoration: none;
    background-color: black;
  }
}
...

感谢

3 个答案:

答案 0 :(得分:2)

默认情况下,Bootstrap有很多自定义。您可以在http://getbootstrap.com/customize/

找到所有选项

只需使用sass变量而不是更少。

$body-bg: #fff;

$navbar-default-color: #000;

$navbar-default-link-color: #000;

依此类推......你会得到你想要的东西

答案 1 :(得分:1)

更改导航栏的颜色

.navbar {
   background-color: red;
}

更改导航栏导航链接颜色

.navbar-nav > li > a {
   color: blue;
}

答案 2 :(得分:0)

div.navbar{
background: red;
color:#fff
}

根据需要更改颜色。