Link element's href property

Many times FCC told me to use “styles.css” as the href value for link element.
But, I’ve been told /.styles.css is the proper way, as /. is a special character combo that says “link me back to the original page”.

Are both equally correct? Does styles.css work because there is no website called styles.css (and so, an attempt to search the page itself is made), or does anything ending with .css automatically link back to the page?

If your ‘index.html’ and ‘styles.css’ files are in the same folder then href=“styles.css”. If the ‘styles.css’ file is in a subfolder then href=“subfolder/styles.css”. It is just an example…

How does the process work though? Right now I understand that there’s 3 different general location groups:

  1. Within the same folder as the referrer
  2. In a different folder, but in the same domain
  3. In a completely different domain

I’m wondering how the compiler figures things out, for example: Checks the same domain folder, then checks the naked/base domain for that path (e.g., and finally checks the given href string as a naked folder/searches on the web for the full given URL.

There is no compiler. There are specs that define how a URL should be parsed (e.g. by a browser) and what a valid URL is.

1 Like

Sorry, I was also talking about parsing, just am too used to scriptwriting.
The link seems useful, but could you specify which section of the page I should be looking for?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.