The way to use background-image in css files with Django

前端 未结 10 1922
离开以前
离开以前 2021-02-05 02:12

I\'d like to use an image file as a background-image on Django. But I do not know how. First, I read this and tried to write like following this in a css file.

10条回答
  •  南笙
    南笙 (楼主)
    2021-02-05 03:02

    In case there's anyone looking for another way to solve this, you may want to hot-link the image from your server or any image hosting service you have access to. Here's how I solved this:

    1. Upload the image in an image hosting site or your server (try Drive/Dropbox)
    2. Right click and open the image in a new tab to access the image URL
    3. Copy the image URL with the (.jpeg, .png) extension and paste in your HTML doc.

    Here's an example:

    https://images.your-host.com/photos/image-path-here.jpeg

提交回复
热议问题