Relative Links for Dummies

I’m feeling extremely stupid right about now. Here I am coding away in strict XHTML, and I just learned how relative links work. :O

Now, I sortof understood how relative links worked before, but I never used them because I never saw the usefulness of them. Relative links are meant to make it easier to move things around, but I always thought people who said that were smoking crack. If you move a page up or down a directory, all your relative links are broken! Consequently, I always preferred using static links for all of my content, like this:

bc. Avatar

However, I just learned that the following relative link does the exact same thing no matter what level the current page is in the heirarchy:

bc. Avatar

What I never knew is that there is a pretty clear distinction between a relative link that starts with a forward slash and one that doesn’t. The starting forward slash tells the browser to start at the root of the site. I can’t believe I never caught onto this before. Sheesh. :eek:

One thought on “Relative Links for Dummies

  1. Joey, the forward slash is a feature left over from the days of UNIX programming. Explore a bit of UNIX, if you haven’t already, and a lot of file addressing machanisms will start making a lot of sense.

Leave a Reply

Your email address will not be published.