Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3223836
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:09:12+00:00 2026-05-17T16:09:12+00:00

I often get confused with the href attribute, the link tag, and the base

  • 0

I often get confused with the href attribute, the link tag, and the base tag. I’m unsure how to properly link the CSS file so a file can be moved into a subfolder and still work (example later on) so I went ahead and found out how the href works when specifying a location.

For your knowledge, I’m working with my localhost, so I have the main htdocs folder and inside that, I have multiple folders, each for a project I’m working on. It ends up looking like this:

localhost/index.php (which redirects to localhost/home/index.php)
localhost/home/
localhost/zune/
localhost/school/
localhost/aeac/

And generally the layout of a folder will be something along these lines:

localhost/aeac/images/
localhost/aeac/stylesheets/
localhost/aeac/scripts/

Going on, let’s say I have the file localhost/aeac/test/index.html and in it, I have 4 links for testing. I’ve found out that

<a href="/"> will link to "localhost/"
<a href="./"> will link to "localhost/aeac/test/" (the directory the file is in.)
<a href="../"> will link to "localhost/aeac/" (the directory above the file.)
<a href="about.html">will link to "localhost/aeac/test/about.html" (the directory the file is in.)

Now that I understand href’s, I need to understand how to link CSS properly.

Imagine the site’s directory looks like this:

localhost/aeac/
localhost/aeac/images/
localhost/aeac/stylesheets/
localhost/aeac/scripts/

and right in the /aeac/ folder I have index.html. The file has a link tag that looks like this:

<link rel="stylesheet" href="stylesheets/main.css" />

So that works out well, main is basically the site’s structure/theme and gets included in every file. The problem occurs when I have to make a subfolder. Now we have a localhost/aeac/users/*username*/index.html. The site still uses the main.css, but the link doesn’t work anymore because there is no stylesheets folder inside there.

That’s where I’m stuck, I imagine that I should be using the base tag to solve my problem but I’m still confused on how that would written. Also, I know I could just change the link tag for all the files in the users folder, but I’d like to know how to do it this way (if that’s even possible.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T16:09:12+00:00Added an answer on May 17, 2026 at 4:09 pm

    I believe you want this:

    <link rel="stylesheet" href="/aeac/stylesheets/main.css" />
    

    This begins with /, so it will always traverse up from the root, not matter where your page is located (i.e. at /aeac/index.html or at /aeac/users/foo/index.html). Now, if you have control over the tag in each copy of index.html (which you probably do), you could also navigate upwards with .., to ../../stylesheets/main.css, but navigating from the root is probably simpler.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use GridViews pretty often and sometimes I get confused to where to put
I often like to create backups when testing the software I work on, and
Could someone explain? I understand the basic concepts behind them but I often see
In OpenGL, one often writes code like this: glPushMatrix(); // modify the current matrix
I often need to develop stuff on the road, with no internet/network connection. I
So this morning I posted a confused question about assembly and I received some
I personally like the exclusive or , ^ , operator when it makes sense
I have been developing a number of components using TFrames and ModelMaker -- I've
I have sales people and bean counters who are trying to sell customizations to
OK I've seen a few people with this issue - but I'm already using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.