Rails Heroku loading part of the background image

霸气de小男生 提交于 2019-12-24 16:35:19

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!