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

CSS CSS Foundations Advanced Selectors Additional Pseudo-Classes

HTML/CSS root element

I try to set the body background to light blue but it doesnt work. body{ background-color:lightblue; } And it doesnt work , i have no idea whats wrong with this

=======================================================================================

Select the root element of the page. Set its background color to lightblue`. Important: The code you write in each task should be added to the code written in the previous task.

<!DOCTYPE html> <html> <head> <title>More Pseudo-classes</title> <link rel="stylesheet" type="text/css" href="page.css"> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <ul> <li><a href="#s1">Section 1</a></li> <li><a href="#s2">Section 2</a></li> </ul>
<div id="s1"> <h2>Section 1</h2> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex. </div> <div id="s2"> <h2>Section 2</h2> Integer laoreet urna ut est cursus nec tristique elit vestibulum. In hac habitasse platea dictumst. Quisque pharetra odio nec urna lobortis sed ultrices dolor posuere. Sed nec nisl id augue congue euismod. </div> </body> </html>

3 Answers

Ronny Gudvangen
Ronny Gudvangen
4,685 Points

If the background is not changing, then you may have a background color defined higher up. Probably in the "html" element.

You can access the html element with:

html {background-color: lightblue;}
Luke Buśk
Luke Buśk
21,598 Points

root {background-color:lightblue;}

:root {background-color: lightblue; }