The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Unable to load image using backgound image in CSS
Richie McCaw
post Apr 26 2007, 05:08 PM
Post #1





Group: Members
Posts: 2
Joined: 26-April 07
Member No.: 2,638



I am having trouble loading background images to my page using style sheets. All other styles are loading fine but when I try a

"body {background-image: url(image.gif) } "

style it won't load. It wont work with any element. I can load any images directly in the html page and even in a with the body tags. Can anybody help?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
JamieHarrop
post Apr 26 2007, 05:30 PM
Post #2


Advanced Member
****

Group: WDG Moderators
Posts: 129
Joined: 25-October 06
From: West Yorkshire, UK
Member No.: 570



I'm going to take a guess and say this is because you're not pointing the URL to the correct location of the image.

For example:

If image.gif is inside the directory "graphics" and your stylesheet is inside a directory called "includes", you'll need to use "../graphics/image.gif" to point to the image.

The "../" at the start of that URL tells the browser to look one directory level down before proceeding to look inside the "graphics" directory.

If you can post a link to the Web site in question, we may be able to determine the location of the image, and tell you what URL you need to use to point to it.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Shadeaux
post Apr 26 2007, 05:43 PM
Post #3


Member
***

Group: Members
Posts: 31
Joined: 24-April 07
Member No.: 2,621



I was going to say the same thing. Every time I've had a style sheet that wouldn't load a background image it was because I pointed to a location off my root directory, and the style sheet was in a "Styles" directory..
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Richie McCaw
post Apr 27 2007, 07:29 AM
Post #4





Group: Members
Posts: 2
Joined: 26-April 07
Member No.: 2,638



Yes that was the case and solved my problem. Thanks fot your help.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 16th December 2018 - 03:05 AM