maskull Posted October 7, 2009 Report Posted October 7, 2009 (edited) Hi. I'm new to web design and am currently struggling to understand a simple URL reference. I hope someone can explain it to me. I encountered the following import statement: @import "/pathxyz/abc.css" I understand that ../ references the parent folder and that pathxyz/abc.css points to the abc.css file in the pathxyz folder, but what does the starting / in the above URL point to? Am I asking the right question? What exactly is that URL saying to me? Edited October 7, 2009 by maskull Quote
falkencreative Posted October 7, 2009 Report Posted October 7, 2009 the "/" goes all the way back to the root folder, no matter which page the link is placed in.. For example: You have this link "/image/img.jpg" on your page http://www.yoursite.com/folder/folder/file.html. The folder your file.html is in doesn't matter -- the link is going to go all the way back to the root (www.yoursite.com/) and then look in the images folder for the image (www.yoursite.com/images/img.jpg). Make sense? Quote
maskull Posted October 7, 2009 Author Report Posted October 7, 2009 Clear as glass! But how does that work locally? If I'm on file:///C:/temp/file.html, for example, what part is the root? Is it file:///C: ? Quote
falkencreative Posted October 7, 2009 Report Posted October 7, 2009 I imagine it would be "file:///C:/" but I'm not 100% sure. Just test it by creating a link to "/" and see where it takes you. In general, I try to avoid using an opening "/" while working on a local machine... Quote
maskull Posted October 7, 2009 Author Report Posted October 7, 2009 In general, I try to avoid using an opening "/" while working on a local machine... That was exactly my quandary. I got the code from a very reputable (and, dare I say, very famous) site, and it confused me to no ends at first. But after your clear and concise explanation, I understand why they did it that why. I won't go into it any further and simply close with a THANKS . Quote
PicnicTutorials Posted October 7, 2009 Report Posted October 7, 2009 Hey, I didn't know that. So if I was two folders deep, instead of saying ../../ to get back to the root, I could just use / ? Quote
falkencreative Posted October 7, 2009 Report Posted October 7, 2009 Hey, I didn't know that. So if I was two folders deep, instead of saying ../../ to get back to the root, I could just use / ? Yes. As I pointed out above though, this sometimes can cause issues when working on a local machine. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.