Where do you put this?

I am wanting to put on a background image for my front page, but don’/t know what the code should look like and where in the page it should be. Makes sense it would be in the body elements in the body in the HTML, but that doesn’t show. Ideas?

I guess google is down again. Seriously, at least put a little effort into helping yourself. A goggle search for “add webpage background image” returns 28,300,000 results. It took more effort for you to find this site, sign up, and post.

That depends on where you want it to be.

Here’s an idea: post the code you tried.

My first step would be to use the W3C validators to make sure the HTML and CSS pass.

If you look in your browser’s dev tools console, and in the left pane click the body tag, you should see something a bit like this.

If in the right pane your CSS for the image has a line through it, the rule is being over-ridden by other CSS.

If that looks good, look under the dev tools network tab, you should not see a “fail”

As for whether it should be a background image for <body> or something else, I can’t comment. That would be a design decision.

I think you are going to lose the OP. Kinda lost me for a second.


<!DOCTYPE html>
body {
    background-image: url("background.gif");

<p>This page has an image as the background!</p>


This thread is an exact duplicate of one you already posted and were given the answer to.

Background image for body

What did you not understand?


This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.