1

main.css

body{
    width:100%;
    height:100%;
    overflow:hidden;
    background:url('/assets/background-calculations.png');
}
body #content{
    z-index:5;
    background:url('/assets/handwritten-text.png');
//  background:white;
    width:100%;
    height:100px;
}
body #footer,#header{
    height:100px;
    width:100%;
    margin:0 auto;
}

index.html.erb 为空白

怀疑

当我background:white;在内容 css 中取消注释它的工作但是当我设置背景 url 它不工作时,但是如果我为内容 div 设置它,相同的 url 不起作用,请帮助

4

2 回答 2

2

如果您在 ruby​​-on-rails 中工作,则您拥有资产 > 图像。把图片放在那里。

在您的样式表文件夹(资产>样式表)中,您必须指向图像,而不是文件夹和图像:

body{
    width:100%;
    height:100%;
    overflow:hidden;
    background:url(background-calculations.png);
}
body #content{
    z-index:5;
    background:url(handwritten-text.png);
    width:100%;
    height:100px;
}

Ruby-on-rails 知道您的图像在哪里

于 2012-08-13T07:19:49.763 回答
1

尝试类似的东西;

body #content{
    z-index:5;
    background-image:url('/assets/handwritten-text.png');
    background-color:white;
    width:100%;
    height:100px;
}

是一个工作现场演示。

于 2012-08-13T07:01:08.603 回答