Welcome to the Treehouse Community
Looking to learn something new?
external link to CSS file, how does it work?
Hi everyone, this is my very first topic on here although I am no stranger when it comes to online forums. I can't seem to find a section for newbies on here so please don't get annoyed with me if this is not the right place to post!
I'm learning CSS atm.
To link CSS externally, you will need to use this:
<link rel="stylesheet" type="text/css" href="mystyle.css"> </head>
so my question is, why does it have to be in the "head" section? Can't I just use them wherever I need them? e.g. in the body section or title section.
also I don't understand type="text/css" whats that for? Just trying to understand the syntax of it thats all. Maybe I'm worried too much.
James Barnett39,199 Points
> why does it have to be in the "head" section
Because that's where web browsers know to look for a CSS file.
> I don't understand type="text/css" whats that for
That tells a web browser that the stylesheet is CSS and not some other kind of stylesheet. However as of HTML5 web browsers now assume any stylesheet is CSS unless they are told differently.