Why is background:url in CSS not working with Django?

前端 未结 2 407
抹茶落季
抹茶落季 2021-01-29 14:03

I have the following CSS code for my navigation bar:

#footer-navigation {
  background: #1841c8 url(\'../images/nav_background.gif\');
  height: 40px;
  padding:         


        
2条回答
  •  星月不相逢
    2021-01-29 14:12

    try setting MEDIA_ROOT in your settings to where the image lives and then use

    {{ MEDIA_URL }}nav_background.gif

    EDIT:

    Jakub Gocławski is right. It would appear your issue is that the image does not exist where you think it exists. If you're still having a problem let us know what you get when you visit localhost:8000/< the path to the image > .

提交回复
热议问题