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?

3 Likes

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

1 Like

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