Jump to content

path to find img


jnf555

Recommended Posts

Right looking at this again, you have css file whatever.css in css folder, which contains body styling, YES!and a images folder INSIDE the css folder yes!, and within that 'images folder a stars.jpg' image, yes! then it should bebody{background-image:url('images/stars.jpg');}if the images folder with image inside, is outside the css folder, then it would bebody{background-image:url('../images/stars.jpg');}if the image is outside image folder, and can be seen along with, css folder and image folder, then it should be body{background-image:url('../stars.jpg');}

Link to comment
Share on other sites

thanks for replyi have two folders in my site folderone css folder containing my css which has a body background has a imgand the other folder images has the img in itthanks for your help i will have a try with your advicejnf555

Link to comment
Share on other sites

spot on works finebody{background-image:url('../images/stars.jpg');}can you please tell me if i have set my site up the hard wayi have a folder for my site, and then put other folders within it to house my css images etc, or is it best to let all the files live together in the main site folder thanks jnf555

Link to comment
Share on other sites

no, setting them up this way will work, you just have to keep it mind when writing out your file paths. The only thing that might make it easier is to keep your stylesheet and html pages together, and then put all your images and scripts in subfolders. Then the paths in both the HTML and CSS will be the same.

Link to comment
Share on other sites

Here is a good discussion of relative file pathsit explains visually the difference between"image/picture.gif""/image/picture.gif""../image/picture.gif"As for relative to the document and relative to the CSS, I find the best approach is to place the CSS at the top level. That way any relative file paths in the CSS are "down from root"

Link to comment
Share on other sites

What i generally do, is have images, that relate to design layout, logos, borders, headings, backgrounds etc within a image folder inside the css folder, images relating to page content are kept in a separate images folder.all you have to do, is get the correct link to the css file, if the image path is correct in relation to the css file it will work with no problem and show these images on the page.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...