By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.

    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

HTML & CSS [HTML] Relative links


This is something that isn't used as much but I thought it was something still worth talking about. If you've used Microsoft CMD or any other software without a visual UI you might be familiar with this.

Two decades ago and more, websites tended to be pretty much set in stone. As a website developer, moving between hosts could be a big pain if you ever needed to change hosts or move your website to a subdomain or a different address you don't have to manually fix each URL. I've heard they are still being used in testing environments, but nowadays many think that they can be detrimental for SEO (even if apparently Google representatives say it doesn't make a difference for SEO with them) and cause unexpected behaviour, so it seems like nowadays it is more recommended for your live projects to stick to absolute ones.

For those of you who hadn't heard of relative URLs, they are when you don't see the full address. There's not a protocol or main domain. The target of the link works usually in relation to your current position and in relation to how you have built the directories between your website. You can specify a "Base URL" if you want, which can be useful for semi-relative links if you, for example, make the base link the directory after your domain page.

One commonly used is "../"to indicate the parent directory of where your current page is.
For example if you're in this page:
You're inside the Traditional directory. If you are trying to link to digital drawings from there, you need the url to jump back to the "drawing" directory and search for "digital".
I think the relative URL would be something like:
<a href="../digital/dpage1.htm">Digital drawings</a>
Feel free to correct me if I got it wrong, I tried to brush up on it but it's been so long and I didn't test things.

My favourite is "/" since that redirects to the top domain. And you usually have that to display whatever you want to make your "home page".
<a href="/">Back to Index</a>

Anyway, do you guys use them at all?
I think I've used "/" pretty much since I started with HTML..

Everything just plays nice, no matter if you're testing something locally or uploading to a production site.

New Threads

Buy us a coffee!

Top Bottom