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
Applying background-color to :root vs body
What factors would lead to applying a background color to the body element and not the :root and vice-versa?
Steven Parker229,005 Points
If the body had styles applied that caused it to not cover the entire viewport (such as an explicit width or margins), you might want to apply a background to its parent element instead. And for the same reason, you might want to use the body to limit it only to the body area.
Note that for an HTML document, the html selector will target the same thing as :root, though :root has a higher specificity (class vs. tag).