this links work in dreamweaver, but as I am teaching myself css I am handcoding everything.
I have a main folder, folder a.
folder a contains:
index.html
style01.css
folder Images
folder htms.
In the htms folder I have
work. html
why can’t i place an image just using
<img src=“imges/image.jpeg”/>?
or
bod{background-image: url(images/bgPat.jpg);}?
the path is correct…I could link them in dreamweaver. The path is the same…what am I not getting?
Not sure I understand that. After all doesn’t a correct path link things regardless of where they are?
the index file & css file are in the same folder & bring in an image from the folder “images” in the next folder down.
the work file & css file are also a folder down from the index file and I am trying to bring in an image from the same “images” folder.
OK … lets say the<img src=“imges/image.jpeg”/> is part of the HTML code in the file work.html then your path is UP a level to reach the images folder.<img src=“…/imges/image.jpeg”/>
bod{background-image: url(images/bgPat.jpg);} is a correct path… but what is bod? if it’s aclss then it needs to be:
.bod{background-image: url(images/bgPat.jpg);}?
if it’s an ID then it needs to be #bod{background-image: url(images/bgPat.jpg);}?
or maybe you meant the body tag?
body{background-image: url(images/bgPat.jpg);}?
Yes for my websites I have a resources folder
then inside it I have stylesheets, scripts, and images.
Suppose main.css exists in the stylesheets directory then it has to go up one folder to the resources directory(…/) and then it can go into the images dir to access the image
./ or / = current directory
…/ = parent directory
…/…/ = parent’s parent (grandparent) directory
and so on from there. But if you to use more than 3 then I would say that the file-system of your website is too complex.
Hello All, The bod was just a typo when I wrote in the sample, sorry.
I added two images. in mainDir I have my main folder w/my index & htms, images folder. then I added the image of what is in my htms folder.
So basically when I am using the file “services.html” that is in the htms folder & I use the <img src=“banner.jpeg” /> tag to place an image that is in the images folder it doesn’t work & I have checked for typos. Also when I use the style sheet to place an image from the images folder, still doens’t work. & the reference css is in the same folder as the htms that is calling on it.
But have no prob placing images using the index.html & its referenced css.
Sorry,hope I am a not making this too confusing.
if your HTML or CSS file is in the root folder, you need to give images/banner.jpeg
if your HTML or CSS file is in the /htms folder, you need to give ../images/banner.jpeg
Note that on your server, you can get around it by always referring to /images/banner.jpeg, but that won’t work when you are looking at it on your hard drive.