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! I think it might have to do with that he's using postgresql and I don't have in on my system.
Here's my 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. There was also a problem with installing the 'pg gem' when I bundled installed. The image is in the app/assets/images directory. 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.
Your options are: image-url("heroimage.png")
, image-path("heroimage.png")
, asset-url("heroimage.png")
or asset-path("heroimage.png")
.
(You can also use ERB helpers if you need to - see the link to the docs below.)
Here's a link to the docs.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.