tes*_*sad 10 css ruby-on-rails twitter-bootstrap
我正在尝试自定义我的rails应用程序导航栏并将css添加到application.css.我知道正在引用application.css,因为应用程序正在从中获取其他样式.但导航栏css试图覆盖bootstrap.css中已有的内容,而应用程序无法识别它...
application.html.erb(布局)
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= analytics_init if Rails.env.production? %>
<link href="../assets/bootstrap-responsive.css" rel="stylesheet">
Run Code Online (Sandbox Code Playgroud)
application.css
body {
padding-top: 20px;
padding-bottom: 60px;
}
/* Custom container */
.container {
margin: 0 auto;
max-width: 1000px;
}
.container > hr {
margin: 0px 0;
}
/* Main marketing message and sign up button */
.jumbotron {
margin: 20px 0;
text-align: center;
}
.jumbotron h1 {
font-size: 100px;
line-height: 1;
}
.jumbotron .lead {
font-size: 24px;
line-height: 1.25;
}
.jumbotron .btn {
font-size: 21px;
padding: 14px 24px;
}
/* Supporting marketing content */
.marketing {
margin: 60px 0;
}
.marketing p + h4 {
margin-top: 28px;
}
/* Customize the navbar links to be fill the entire space of the .navbar */
.navbar .navbar-inner {
padding: 0;
}
.navbar .nav {
margin: 0;
display: table;
width: 100%;
}
.navbar .nav li {
display: table-cell;
width: 1%;
float: none;
}
.navbar .nav li a {
font-weight: bold;
text-align: center;
border-left: 1px solid rgba(255,255,255,.75);
border-right: 1px solid rgba(0,0,0,.1);
}
.navbar .nav li:first-child a {
border-left: 0;
border-radius: 3px 0 0 3px;
}
.navbar .nav li:last-child a {
border-right: 0;
border-radius: 0 3px 3px 0;
}
Run Code Online (Sandbox Code Playgroud)
我错过了什么吗?
Gal*_*len 20
尝试让您的application.css仅用于"需求"目的,它将为您跟踪错误以及利用Rails3资产管道堆栈铺平道路.
在你的app/assets/stylesheets/application.css中:
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
*
*= require_self
*= require bootstrap
*= require bootstrap_responsive
*= require my_styles
*/
Run Code Online (Sandbox Code Playgroud)
在你的app/assets/stylesheets/my_styles.css中,将你现在拥有的自定义css放在application.css中.
这样你的自定义样式将在所有引导程序之后加载,覆盖它.
说实话,我认为这就是你现在正在发生的事情:它不是bootstrap.css什么是覆盖你的风格,它是bootstrap_responsive,因为它是你的风格后加载.
| 归档时间: |
|
| 查看次数: |
15668 次 |
| 最近记录: |