[英]background image wont show up in the rails app i'm working on
I'm trying to do some front-end design work in a rails app and I can't seem to get the background image to show up in my hero section! 我正在尝试在Rails应用程序中进行一些前端设计工作,但似乎无法在英雄部分中显示背景图片! I think it might have to do with that he's using postgresql and I don't have in on my system.
我认为这可能与他使用的是postgresql有关,而我的系统中没有。
Here's my css/scss 这是我的css / scss
/*************************HOME PAGE*************************/
body {
font-family: 'Poiret One', cursive;
}
.head {
border-bottom-style: solid;
border-color: #fff;
border-bottom-width: 1px;
padding-bottom: 12px;
padding-top: 12px;
}
.headtext {
font-size: 200%;
padding-top: 67px;
font-weight: bold;
}
.hero {
background: url('heroimage.png');
background-size: cover;
background-position: center;
width: 100%;
height: 600px;
I've ran the "bundle exec rake assets:precompile RAILS_ENV=production" and the "rake assets:precompile" command to see if it helps and it still doesn't seem to be showing up. 我已经运行了“捆绑执行耙资产:precompile RAILS_ENV = production”和“耙资产:precompile”命令,以查看是否有帮助,但它似乎仍然没有出现。 There was also a problem with installing the 'pg gem' when I bundled installed.
捆绑安装时安装“ pg gem”时也存在问题。 The image is in the app/assets/images directory.
该图像位于app / assets / images目录中。 Sorry for my ignorance!
抱歉,我的无知! Thanks!
谢谢!
If you use the provided SASS helper methods, Rails/Sprockets will intelligently look for the image in app/assets
, vendor/assets
, public
, etc. 如果使用提供的SASS辅助方法,Rails / Sprockets将智能地在
app/assets
, vendor/assets
, public
等中查找图像。
Your options are: image-url("heroimage.png")
, image-path("heroimage.png")
, asset-url("heroimage.png")
or asset-path("heroimage.png")
. 您可以选择以下选项:
image-url("heroimage.png")
, image-path("heroimage.png")
, asset-url("heroimage.png")
或asset-path("heroimage.png")
。
(You can also use ERB helpers if you need to - see the link to the docs below.) (如果需要,您也可以使用ERB帮助器-请参阅下面的文档链接。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.