Home > other >  Can't make path right in css on django site
Can't make path right in css on django site

Time:09-22

I'm working in django, and I have one page that I have inputed css in html file, and from there I need to call background image (to be honest did not work with css in a while). However I make path is not working, even put photo in same folder with html file, created new one, nothing. I would like to put it in Django_site/static/images/1.jpg. Currently I'm in Django folder Django_site/Django_app/templates/Django_app/my.html. What do you suggest?

.bgimg {
  background-image: url('images/1.jpg');
  height: 100%;
  background-position: center;

CodePudding user response:

 background-image: url("{% static 'images/1.jpg' %}")

CodePudding user response:

You can move any CSS that contains static file paths to inline CSS, contained in the template.

please visit in this link

  • Related