Reputation: 450
How to set html body background image my images is inside FlasApp-->static-->in static there are two folders(css and images)--> In .css file used the below code:
body {
background: url("images/background.jpg");
}
In .html file used the below code:
<link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}">
But neither background color is shown nor background image.
Upvotes: 2
Views: 7467
Reputation: 7402
try it
body {
background-image: url({{ url_for('static', filename='images/background.jpg') }})
}
but i think that this always will work, because you forgot to put /static/
in front of images/background.jpg
, and it need to be background-image
not only background
body {
background-image: url("/static/images/background.jpg");
}
Upvotes: 5