Answer the question
In order to leave comments, you need to log in
How to put an image on background in html in python django?
I want to put an image in the background of an HTML template, but it displays a white background. Path to the image
PROJECT_DIRECTORY/static/bg.jpg .
In settings.py it says:
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
body {
background-image: url({% static "bg.jpg"%});
background-size: 100hv;
background-attachment: fixed;
}
background-image: url(static/bg.jpg);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question