jnf555 Posted February 12, 2010 Share Posted February 12, 2010 hi i am sure there is a simple answer to this.i have a body background set to use a img, the img is in a diferent folder,how do i set the path?body {background-image:url('bgdesert.jpg');}thanks jnf555 Link to comment Share on other sites More sharing options...
ShadowMage Posted February 12, 2010 Share Posted February 12, 2010 A forwardslash '/' looks in the root of your web site. Then you just type the path to the folder. For example:body {background-image:url('/folder1/folder2/bgdesert.jpg');}Of course there are other ways depending on the images relative location to the CSS file. Link to comment Share on other sites More sharing options...
jnf555 Posted February 12, 2010 Author Share Posted February 12, 2010 thanksjnf555 Link to comment Share on other sites More sharing options...
Synook Posted February 13, 2010 Share Posted February 13, 2010 The "other ways" are "./" to refer to the current directory and "../" to refer to the parent. Link to comment Share on other sites More sharing options...
stewh Posted February 16, 2010 Share Posted February 16, 2010 Hi There, I'm having the same problem. i.e.body{ background-image:url('/images/zz-bg-21.gif');}doesn't work. The image is in my images folder, which is in the same folder as the html file.Regards, Stewart Link to comment Share on other sites More sharing options...
jnf555 Posted February 16, 2010 Author Share Posted February 16, 2010 Hi There, I'm having the same problem. i.e.body{ background-image:url('/images/zz-bg-21.gif');}doesn't work. The image is in my images folder, which is in the same folder as the html file.Regards, Stewart Link to comment Share on other sites More sharing options...
thescientist Posted February 16, 2010 Share Posted February 16, 2010 Hi There, I'm having the same problem. i.e.body{ background-image:url('/images/zz-bg-21.gif');}doesn't work. The image is in my images folder, which is in the same folder as the html file.Regards, Stewarttry thisbackground-image: url('images/zz-bg-21.gif');and/or check your spelling.edit: where is the image in relation to your CSS file? Link to comment Share on other sites More sharing options...
jnf555 Posted February 16, 2010 Author Share Posted February 16, 2010 hi stewarti am a bit of a learner myselve,but i managed to work it out.see synook reply. (../images/background2.png)regardsjnf555 Link to comment Share on other sites More sharing options...
stewh Posted February 16, 2010 Share Posted February 16, 2010 try thisbackground-image: url('images/zz-bg-21.gif');and/or check your spelling.edit: where is the image in relation to your CSS file?That did the trick; missing a space before the url. I was tearing my hair out over this.Cheers, Stewart Link to comment Share on other sites More sharing options...
ShadowMage Posted February 16, 2010 Share Posted February 16, 2010 That did the trick; missing a space before the url. I was tearing my hair out over this.Cheers, StewartActually it wasn't the space that was throwing it off. It was the '/' in front of images. The forward slash refers to the root of your website. If your HTML file and the images folder are in a subdirectory of your website then you also need to include that in the path. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.