PDA

View Full Version : why this happen?? the path of image is wrong


houserabbit
08-03-2009, 03:04 AM
the path of my image is wrong...
(../images/menu.jpg)



here is my html code for linking css style code:
<link rel="stylesheet" href="includes/menu.css" type="text/css" />

but in css stylesheet,
the path of image name cant setting properly, like image/menu.jpg
[CODE]#nav {padding:0 0 0 30px; margin:0; list-style:none; font: 12px arial, sans-serif; position:relative; z-index:200; background:url(../images/menu.jpg) 0 0 no-repeat; height:40px; width:895px;}CODE]

the css stylesheet and image have put in the right folder, but the path of the image still have problem, why this happen??

edbr
08-03-2009, 03:42 AM
that looks like the correct path form your includes folder

houserabbit
08-03-2009, 06:07 AM
that looks like the correct path form your includes folder


but normally not only images/menu.jpg?? (now is ../images/menu.jpg)

Corrosive
08-03-2009, 07:38 AM
Just change it by hand then.

houserabbit
08-03-2009, 09:12 AM
Just change it by hand then.


if change it to images/menu.jpg
the image will disappear
how come like that??

Corrosive
08-03-2009, 09:21 AM
Because your 'includes' folder is a structure level down. The image path that DW creates automatically is correct for where the file sits (../images/yourimage.jpg) but, when it is called into you main page, say index.php, that path becomes incorrect. You need to look at it as being part of the mark-up of your index page. This means that (images/yourimage.jpg) IS correct for index.php but isn't correct for your 'includes' file so the image disappears...but it will display correctly in index.php. I hope that makes sense as it is a hard concept to get across in words! :confused:

edbr
08-03-2009, 09:23 AM
then dont change it . as i said it looks right from your includes folder >>/ means 'folder above '

houserabbit
08-03-2009, 09:26 AM
then dont change it . as i said it looks right from your includes folder >>/ means 'folder above '


ok, thank
maybe i am too worry..:mrgreen:

DWcourse
08-03-2009, 12:54 PM
You can always use links relative to the site root so that your link would be /images/yourimage.jpg and work from any location in the site. It's a good solution if the link is in an include file that's called from files in different directores.