Step 19 and its intricacy (Basis CSS)

So, I’ve used the body selector, but the page is not changing to the color brown.
I’ve already had the color set to brown but, it’s still giving me an error that I need a body selector. Plus, the color looks dark red instead of brown.

Here’s my code:

<style>
  body {background-color: brown;}
  </style>

Link to the challenge:
Learn Basic CSS by Building a Cafe Menu: Step 19 | freeCodeCamp.org

Are you writing this in the .css file?
<style> is an HTML tag used to enclose CSS code. It is a valid way to include CSS in an HTML file, but not valid in a CSS file. Your CSS:

looks valid, I would just remove the <style> tags.


on a side note,

I’ve thought that for a long time! I believe it is the “correct” color though, just the choice made when they wrote CSS standards, or just the particular browser’s (and hardware’s) choice of rendering.

EDIT:
Quick google search showed #A52A2A to be the hexidecimal value for brown.

1 Like

It worked, thank you, this is so awesome, I never thought that including a style tag within the CSS code would disrupt the answer in particular. for HTML you are right it’s fine, I just needed to delete the style in the CSS code, and only put the body. Thank you!!

1 Like

Well, <style> is an HTML element so you can’t use it inside CSS.

CSS uses element types for the selector and not tags, so the parser doesn’t know what <style> is and just bails.

Tag > <body>
Element type > body

You can tell by doing this:

body {
  background: red;
}
<style>
body {
  background: green;
}

The background is set to red and then the error causes the page not to become green.

2 Likes