Jump to content

Recommended Posts

Posted (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 by maskull
Posted

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?

Posted
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 :).

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...