Ruby on rails 在样式rails 4中添加背景图像

Ruby on rails 在样式rails 4中添加背景图像,ruby-on-rails,twitter-bootstrap,ruby-on-rails-4,asset-pipeline,Ruby On Rails,Twitter Bootstrap,Ruby On Rails 4,Asset Pipeline,我正在尝试在我的网页上添加背景图像,当我使用平面html时,它是有效的,但现在我正在将它集成到我的rails应用程序中 我使用这段代码将图像嵌入到rails应用程序中 <div class="jumbotron" style="background-image:

我正在尝试在我的网页上添加背景图像,当我使用平面html时,它是有效的,但现在我正在将它集成到我的rails应用程序中

我使用这段代码将图像嵌入到rails应用程序中

  <div class="jumbotron" style="background-image:                                                                                                                                                            
                                    "url(image-url('lines3.png')";                                                                                                                                             
                                      background-repeat: repeat-x;                                                                                                                                             
                                      background-position: center bottom">

它不会在日志中引发任何异常,但也不会显示图像,可以建议您将
“背景图像:”url(图像url('lines3.png')”;
更改为
“背景图像:”图像url(图像url('lines3.png');


或者您可以尝试使用:
背景图像:url()
您可以这样做

<div class="jumbotron">
</div>

CSS


琼伯伦先生{
背景图像:图像url('lines3.png');
背景重复:重复-x;
背景位置:中底;
}

在chrome inspector中查看div的呈现html。查看实际图像url是什么,并检查您是否可以在另一个选项卡中作为独立url访问该url。这应该会指出问题所在。您的意思是删除div和样式标记否,我的意思是将
url()
更改为
image-url()
。也许这会有帮助。它们都不起作用,我想问题是它在div中,样式是你的图像放在
app/assets/images
目录中吗?你不应该使用内联样式。@pavan答案应该适合你。
<style>

.jumbotron{
  background-image: image-url('lines3.png');
  background-repeat: repeat-x;
  background-position: center bottom;
  }

</style>