铁路css设置背景图像

时间:2012-08-13 03:47:53

标签: css ruby-on-rails-3.2

的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为空

疑问

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

2 个答案:

答案 0 :(得分: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知道你的图像在哪里

答案 1 :(得分:1)

尝试类似的事情;

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

Here 是一个现场演示。