Html/css overview/12


I put the link like this:

 <link rel="stylesheet" href="stylesheet.css" type="text/css">

When I press save & submit code this appears:"Oops, try again. Did you remember to close your tag?".

But I closed my tag.

Have I?? or is it an error?


Yea because it has to be a self closing tag like this...

<link rel="stylesheet" href="someStylesheet.css" type="text/css"/>


Code posted by @alantlb is completely correct. link is a void element, not self-closing. This is why end tag must be omitted and / is completely optional.

This is a codecademy bug.

Link to documentation ->


Yea you said it is "optional". Well codecademy could have taken it as a "must", so why not try that as a solution?


Well, you are right, this is the first thing user should try. But let's be honest for a while. Does Codecademy has any authority to lever coding standards and language references? I don't think so.

They do the same thing in other courses. You can learn that there are multiple lines comments in python, that order of values in the border shorthand is important, that it should be :first-letter, not ::first-letter etc. That is what makes Codecademy a bad learning resource.

If code written by the user is correct and output is correct - exercise should be accepted.

Because of mistakes like this, you think that link is a self-closing tag, you don't understand the difference between object creation and data parsing. Help others by making sure that what you write is correct. Seriously, it would take you... 40 seconds to check if link is self-closing or a void element.