问题
I have a rails app on Heroku. In this app I have background images and I call them as;
<div class="fill" style="background-image:url('<%= asset_path ('4.jpg') %>');">
The background images working but suddenly, it started showing some part of them.
Why is this happening? Realized that also happens for the main page carousel slider bakground images. But when I check background link, it shows the full picture but image not loading on slider.
回答1:
Try to use image_tag. Here is an example with an image located in app/assets/images
<div class="fill">
<%= image_tag("4")%>
</div>
来源:https://stackoverflow.com/questions/37448068/rails-heroku-loading-part-of-the-background-image