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

HTML How to Make a Website Creating HTML Content Include External CSS

Position of "link rel="stylesheet" href="css/normalize.css" ?

So in the video, the line "link rel="stylesheet" href="css/normalize.css" was put underneath the title. Is there a reason for this? Can we put that line anywhere else in the code?

3 Answers

ryan champin
ryan champin
16,836 Points

you can put it where ever you want technically....but its best practice to put it before ALL of your elements ur trying to style....the head is the best place...you can put it anywhere in the head unless there are multiple stylesheets....then you should be aware of the ordering

ryan champin
ryan champin
16,836 Points

the position of the style sheet or javascript links in an html doc is relative to the way the page loads....we usually want our css styles to load before the content of the page loads....that way the html elements will appear styled. if we put the stylesheet at the bottom...the content will appear unstyled and then when the page reaches the stylesheet link....then they will get styled.....and thats no bueno...

Why can't we put that line above them? Like right after we put <html>?

It's ideal to load css in the header,there is no rule to add it just after title,it's better to add external css inside <head> tag,if you want to load all your styles when page loads you should always add external css inside head.So basically you can add it anywhere inside head tag.

You both gave me awesome answers - thank you!