FAQ: Learn CSS Selectors Visual Rules - CSS Setup Selectors - Linking the CSS File

faq

#1

This community-built FAQ covers the “Linking the CSS File” exercise in Codecademy’s CSS lessons.

FAQs on the CSS exercise Linking the CSS File

Join the Discussion. We Want to Hear From You!

Have a new question or can answer someone else’s? Reply (reply) to an existing thread!

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

Need broader help or resources about CSS in general? Go here!

Want to take the conversation in a totally different direction? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

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

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


#2

Other FAQs

The following are links to additional questions that our community has asked about this exercise:

Not seeing your question? It may still have been asked before – try searching for it by clicking the spyglass icon (search) in the top-right of this page. Still can’t find it? Ask it below by hitting the reply button below this post (reply).


#4

In this example, (href="styl. . . " type=“text/css” rel. . . . ),
why is it written “text/css” rather than .css?
Thank you.


#5

because its mime type, not the file extension, see docs:

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link


#6

Nice, a lot of good info there.
I always want to know, not only how something works, but why it works.
Makes it a lot easier to compehend.
Thanks again,

-Mark-


#7

In learning to link the CSS and HTML, I have found different various ways to do this. Is there a standard way ? Or does it really matter if the “rel” attribute comes in the end or the beginning of the code?


#8

it doesn’t matter, attribute order isn’t relevant.


#9

Thank you for your help!!!


#10

does the rel attribute always have to equal to stylesheet?


#11

nope, but this you could have found in documentation:

https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types


#12

why does it say set it equal to style.css and not ‘./style.css’ on step 2?
does a relative pathway in the same folder only need the file name and extension?


#13

Correct. ./ is the current folder.


#14

Are all three attributes (rel, type, and href) needed in the link element in order for the styling to be applied to the HTML document? I fiddled with it, and it worked without the “type” attribute.


#15

the type attribute can indeed be omitted since html5


#16

Thank you so much for that input.