我在Rails 3.2.21上运行Ruby 1.9.3。 我已将jumbotron类添加到了我的idex.html.erb文件的顶部。在jumbotron中不显示背景图像
<div class="jumbotron">
<h1>Handcrafted items from <br>
around the world.</h1>
<h2>Discover one-of-a-kind items</h2>
</div>
然后在我的custom.css.scss文件,我已经添加了背景图像的信息:
@import "bootstrap";
body {
background-color: #F5F5F1;
color: #333333;
font-family: Arial, Helvetica, sans-serif;
}
.navbar-default {
background-color: #EFEFEB;
}
.navbar-default .navbar-brand {
font-family: guardian-egyptt, georgia, serif;
font-weight: 400;
color: #d5641c;
font-size: 30px;
}
.navbar-default .navbar-nav > li > a {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
font-weight: bold;
color: #0192B5;
}
.center {
text-align: center;
}
.col-md-3:nth-child(4n+1) {
clear: left;
}
.col-md-6 {
h3 {font-size: 45px;}
h5 {font-size: 25px;}
p {font-size: 18px;}
}
.caption {
h3 {
font-size: 17px;
margin: 2px;
}
p {
font-size: 15px;
margin: 0px;
}
}
.jumbotron {
background-image: url('jumbotron.jpg');
}
文件jumbotron.jpg
的指示已经被保存到文件夹app/assets/images
。这对教练很有用,他的jumbotron现在显示选中的背景图片,但我的不是。我的只是一个带有文字的盒子,图像不在那里。
我做错了什么?
我试过了。同样的结果,图像仍然没有显示。 – 2015-04-04 03:06:21
在css文件中生成什么URL?服务器上清单文件中该文件的URL是什么?部署到服务器时是否编译了资产? – spickermann 2015-04-04 06:11:28
对不起,我非常喜欢这个。这是我与RoR的第一个应用程序。我不明白你在问什么。如果有帮助,这些文件在这里:https://github.com/crista-b/etsydemo – 2015-04-04 12:42:59