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 Basics (2014) Basic Layout Backgrounds: Color and Images

Can you clarify what the instructor say: ".. everything except the margin area is consider the background layer"

The instructor say: "In an HTML element, everything except the margin area is considered the background layer, and every element has a background layer that is transparent by default"

Does this mean that... When you creating an HTML tag without any text inside, you won't see anything on the browser because the background layer is transparent. when you add text to inside an element tag( paragraph, list etc..) , you adding it on top of a background.

I think it might refer to if you use text on top of a image and you use margin for the text its going to push the image up or down in the viewport causing a white space and making your image look funny.

1 Answer

Phil Livermore
Phil Livermore
11,018 Points

I would say they are refering to the CSS Box Model.

Any background-color or image will fill the padding and content area, but not the margin (assuming you have the box-sizing set to border-box). The content area could be text, as an example, so the background colour would appear behind the text and also cover any padding, but not the margin. The content area could also be something like a fixed height <div> element so it does not just relate to text.