0

I am using the following code, but it is having no effect!! Can this be done?

    html {
          background: #d9dbdc url('images/repeat-x.png') repeat-x;
    }
2
  • 3
    You'll want to add that image to body{} I believe... Other than that, just make sure the path is valid. Commented Apr 6, 2011 at 13:27
  • 1
    html is not an html element :) Commented Apr 6, 2011 at 13:28

4 Answers 4

2

This will work if you actually have an image at the specified location, although it's usually applied to the body element. It could be that the body element has a background colour that is covering the image.

Note that paths are relative to the style sheet file, not the HTML file embedding it, so a path pointing to images/repeat-x.png in /css/styles.css would result in /css/images/repeat-x.png.

Sign up to request clarification or add additional context in comments.

Comments

2

Yes, it can be done, but it needs to be on the <body> tag.

Your image might not exist, or you might have a different background covering it.

Comments

1

If you are trying to set the background of the entire page I'd recommend:

body { background: #d9dbdc url('images/repeat-x.png') repeat-x; }

Comments

0

make sure the url is correct, you can use browser debug tool like Firebug in firefox to inspect the html

2 Comments

If you're using Chrome you can do a right click on page, click "Inspect Element" and on the Resources tab you can find the resource and see if its missing.
short cut is ctrl +shift + J :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.