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
davide totaro5,559 Points
hi everyone, I have got a question, why we need to use in the head section before title, <meta charset="utf-8">
thanks in advance to everyone!!!!
Jeffrey WattersCourses Plus Student 7,403 Points
I began learning HTML in 1994. I was taught that the HTML document worked as if it were multiple switches. As an example you start by declaring what it is you are coding, which is HTML and so inside the code for the document you would place <HTML> tag, which includes all your other code. Then of course you don't leave a switch on when you leave a room so there is an ending switch at the end of the document.
Inside HTML there were three sections at the time (1994, this has changed over time) the HEAD (opening and closing tags), the body, and the Address (now called the footer as address now means something different and is coded differently as well). Each section communicated instructions for the browser for display purposes. So in the HEAD section you had the META DATA, such as a description, keywords, character code, and external files to apply to the document for formatting and user interaction such as a script. In the body section tags you place the information you want displayed on screen and the address section is now not used outside the body tag and has a different meaning.
The HEAD portion does not show directly on screen, it is translated and applied to the document and then used to assist with the display of your HTML elements within the body section. So only the body and address (now footer) would show on the users monitor being aided by the declarations within the HEAD section of the document.
So the reason why you put <meta charset="utf-8"> in the head is it is an instruction for display purposes which is telling the browser to use the utf-8 character set instead of some other character set. Of course utf-8 is the default but it still needs to be declared. See more: http://www.w3schools.com/tags/ref_charactersets.asp
I hope this helps.