|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
CSS: Background Image Path
Hi there
![]() I have a probelm linking to a background image using CSS. I am using this line: background-image:url('/path/back01.gif'); "path" is the direct path underneath localhost. The picture shows up when I am trying the view it with my browser (http://localhost/path/back01.gif) . But in my PHP File it doesn't. I am using the direct path because the paths of my PHP File are a bit confusing - so I thought it would be easier, but it doesn't work. I am having a php file, that includes other php files with functions, and these functions include the stylesheet: index.php |-include |+-functions.php ||-stylesheet.css |-images |+-back01.gif index.php should show the background image, the stylesheet links to the image and the stylesheet is printed into the index.php by the functions, I mean it is linked. Do I have to specify the path for the background-image option so that I recognizes it that it is a direct path? Thanks for taking your time ![]() |
|
#2
|
|||
|
|||
|
How are you linking to the stylesheet? Probably the php server cant find your css file.
http://galileo.spaceports.com/~ibidris/ |
|
#3
|
||||
|
||||
|
The path should be relative to where the css file calling the image is.
Lets say you have the set up: http://localhost/path/index.php http://localhost/path/images/back01.gif http://localhost/path/styles/stylesheet.css If you are importing or calling a CCS in index.php you path in the css to the image would be: background-image:url('../back01.gif'); Alternatively, you could use full URL. HTH Jamie
__________________
Cheers, Jamie # skiFFie | Home of the 'accessibility module' for Drupal # Jamie Burns [me] Accessibility Module [drupal] # guidelines | search | wap resources | not getting help | fold to cure # Any form of employment is strictly prohibited ...... __________________ Let the might of your compassion arise to bring a quick end to the flowing stream of the blood and tears ..... Please hear my anguished words of truth. __________________ |
|
#4
|
||||
|
||||
|
Hmm I am pretty sure that my Server can find the CSS file, as nothing would be formatted on the whole page without it.
jabba_29: The direct and full path would be the "safer" way. By that I mean that it should work 100% right? I was using the way that you ary saying, relative to the location of the css stylesheet not the php file, but still it didn't work. But as I said the direct path shows up the picture, how can I put the full path into the url? as url("http://localhost/path/images/back01.gif"); doesn't work. |
![]() |
| Viewing: Dev Shed Forums > Web Design > CSS Help > CSS: Background Image Path |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|