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 Treehouse Club: HTML Publish a Story The Body

Kim Connolly
Kim Connolly
2,475 Points

HTML background color error with code

I was playing around with the background color of the page and inserted this code here:

<!DOCTYPE html>
<html>
<head>

  <title>First Run</title>
  <meta charset="utf-8">

 <style>
    h1 {text-align: center; color: blue; font-family:sans-serif}
    h2 {text-align: center; color: magenta; font-family:sans-serif}
    p  {color:maroon; font-family:sans-serif}
  </style>

</head>

<body>
  <h1>A Mid-day Lunch</h1>
    <h2>By Kim C</h2>
  <body style="background-color:powderblue;">

<p>Begin story</p>

Fast forward to the bottom of the code, the very last line </html> instantly highlighted in red after I inserted this background color code in this spot. Does this mean I put it in the wrong spot or did not close the brackets correctly?

Kim Connolly
Kim Connolly
2,475 Points

Update: Tried that >pluboj but it didn't change. I moved the background color code up in between the style brackets, the red highlight on </html> is now gone. Thank you!

<!DOCTYPE html> <html> <head>

<title>First Run</title> <meta charset="utf-8">

<style> h1 {text-align: center; color: blue; font-family:sans-serif;} h3 {text-align: center; color: magenta; font-family:sans-serif;} p {color:maroon; font-family:sans-serif;} body {background-color:powderblue;} </style>

</head>

<body> <h1>A Mid-day Lunch</h1> <h3>By Kim Connolly</h3>

<p> Begin Story </p>

</body> </html>

2 Answers

You are missing semicolon after sans-serif

shubham kandharkar
shubham kandharkar
2,354 Points

<!DOCTYPE html> <html> <head>

<title>First Run</title> <meta charset="utf-8">

<style> h1 {text-align: center; color: blue; font-family:sans-serif} h2 {text-align: center; color: magenta; font-family:sans-serif} p {color:maroon; font-family:sans-serif} </style>

</head>

<body> <h1>A Mid-day Lunch</h1> <h2>By Kim C</h2> <body style=background-color:powderblue>

<p>Begin story</p>

Try this code this will work