Lesson 4 css overview - not clear!



Hi, it may seem dumb. if I consider the following code (putting CSS in the same file as HTML) shouldn't the style tag "color: purple" apply just to the head section? since it's nested into the tags...
In fact the result page gives the BODY paragraph colored in purple.
It doesn't seem really logic...

<!DOCTYPE html>
			p {
				color: purple;
		<p>Check it out! I'm purple!</p>



You can't have paragraphs in the head soooo...

How is it supposed to apply there?


That's my point. The code I copied was the one given in the lesson, not written from me...


doesn't matter, you use <style></style>, which means you are using css, which means it is applied to whole document


Thank you so much hehe


Well, you should have written it yourself, because you are more likely to learn it that way, just saying.

As Cade said:

Which is a very good point. You can only style things in the body, no matter where you put the style tags.

Even this CSS code that you posted

p {
  color: purple;

tells you what it's styling. See there where it says p { ? That's the opening, and the p represents the <p></p> tags in the body, meaning that the paragraph will have the styling color: purple.