FAQ: Setup and Syntax - Linking the CSS File

This community-built FAQ covers the “Linking the CSS File” exercise from the lesson “Setup and Syntax”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Full-Stack Engineer
Front-End Engineer
Back-End Engineer

FAQs on the exercise Linking the CSS File

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!
You can also find further discussion and get answers to your questions over in #get-help.

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head to #get-help and #community:tips-and-resources. If you are wanting feedback or inspiration for a project, check out #project.

Looking for motivation to keep learning? Join our wider discussions in #community

Learn more about how to use this guide.

Found a bug? Report it online, or post in #community:Codecademy-Bug-Reporting

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

Double quote or single quote which one is best practice? I saw that top websites used the double quote for linking their stylesheet in the <link> tag. Codecademy also used double quotation. So why a single quote for the lesson?


When I started learning CSS, the link to the CSS file had to include type=“text/css” why is that no longer being used?


I’d like to know more about the rel attribute of the <link> element. What values can it take?

1 Like

#get-help I also want to know rel attribute other values

Yes, I also have the same question.

Hi Please how would you know if the CSS file is in the same directory as the html file?

Single and double quotation marks can be used interchangeably in HTML to access files, directories or external hyperlinks. W3C protocols require using Unicode in place of certain special characters for URLs, and having these two on that “do not use” list prevents errors caused by cutoff hyperlinks.

You’ll also find similar syntax rules in JavaScript regarding functions, objects and text strings, because JS and CSS are integral part of HTML-based programming. Introducing you to using single quotes is a means of developing good coding habits through consistency and convenience.

As long as everything works the way it should, how you do it is based on what works best for you.

The lesson asks us to set the link href equal to style.css rather than ./style.css. They both apply the stylesheet. Why is it that we don’t need the relative path in this case?

1 Like

Hi, if I was creating a website, it would depend on me where I place an HTML file(s) and CSS file(s). The CSS file is often placed in the ‘css’ directory inside of the directory where is the ‘index.html’ file, so in such cases, the relative path is ‘css/style.css’. But for educational purposes with small projects is the ‘style.css’ file usually just in the same folder as HTML file, so the relative path consists only of the name of the CSS file.


Looking at the thread

there is an exchange in the comments between users Coomie and teemoh:

Teemoh: So whats the difference between ./abc.htm and just abc.htm ?
Coomie: @Teemoh They’re the same in JS, HTML and CSS. The “./” is a old programing convention that carried over into these newer languages. In other circumstance they could mean different things. eg. if a “path” is set in an OS abc.exe could be a file and ./abc.exe might not.

1 Like

Dear all , I have a question if we will write link attribute inside body tag then it also works fine then why we write link any external css file or any styling in the head tag?

what do you mean I did not understand