Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS How to Make a Website CSS: Cascading Style Sheets Use ID Selectors

jennifer ray
jennifer ray
7,875 Points

css

what is the point of the following code?

<link rel="stylesheet" href="css/normalize.css">
       <link rel="stylesheet" href="css/main.css">

The bottom line of code relates to the style of the page which we create and linking it back to the html? but i am unsure what the top line of code does and why it is there?

I've fixed the formatting to show both lines of code.

5 Answers

sidd
sidd
4,141 Points

Normalize.css is used to reset default browser styles.

All browsers by default define their own styles. Not resetting them first to start with can have funny looking styling.

So normalize.css creates a level playing field across browsers (nearly all of them) and then you can write your own CSS on top of that (main.css) to style your document.

Jeff Lemay
Jeff Lemay
14,268 Points

I only see one line of code but it seems like "top line" is referring to the first half of the line (rel="stylesheet"). This is just declaring what type of file you are linking too. Could be javascript, could be apple-touch-icon-precomposed (similar to a favicon), or something else.

You can find a whole boatload of info here: http://www.w3.org/TR/html40/struct/links.html#edef-LINK

Ariel Aronica
Ariel Aronica
6,646 Points

This is how you link your CSS to the HTML. So with this link you are basically saying "the type of file I am connecting is a stylesheet, and the direction to the link to this file is "css/main.css". It is located in the css folder, hence the css/, and the name of the css file is main.css.

jennifer ray
jennifer ray
7,875 Points

I get it now, thank you very much :)

jennifer ray
jennifer ray
7,875 Points

Excellent answer Siddharth. Thank you very much :)