Nikita Manahov Nikita Manahov - 2 years ago 66
HTML Question

Add a background image through css

I have attempted adding a sky background to my website's stylesheet, but nothing really happened.

body {
background: "sky-08.jpg";

When I previewed the page, the background was white, like when I just started making my page.

Answer Source

It should be: background-image: url("sky-08.jpg");

This also assumes that the image file is in the same location as the CSS file (Or HTML file if it is inline)

If the image is located under an images folder in the root directory: background-image: url("/images/sky-08.jpg");

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download