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 Beginning HTML and CSS Write a CSS Selector and Property

Peter DeLuca
Peter DeLuca
3,606 Points

Beginning HTML and CSS

Why would the exercise have you put the style tag inside the body? Nobody would ever do this, even if they did want to add css styling to the h1 they would put it above the body.

2 Answers

It's not exactly a mistake, but, yes it usually is in the <head> tag. Syntactically, it can be any where inside the html document. However, later on you can see that the order of the tags, even for scripts and stylesheets do affect how the document is rendered. For a simple a example, if there are two same styles with the same level of detail, important, the one below is valid.

That's why they call it Cascading Style Sheets (CSS). You can either place an inline style as an attribute to an element or you can have a styles in the <head> or you can have them an external file. The latter is the norm nowadays.