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

Padding and background-color on inline (inline-block)

Guys, when teacher makes li items inline-block and sets up padding with right border, why the background color is not betwen border and content? Does't paddind area have bg-color?

I'm not sure which exercise you're on, but yes, padding includes the background color. The background color also exists behind the content, so it wouldn't be "between the border and content" exactly- it would be between the borders.

I hope this helps!

1 Answer

Correct me if i'm wrong, but when i add not all 4 borders in item, then between content and (example top and right border) will be no bg-color. Color shows up only when there is 4 borders?

My question was from this video 5:30 min. https://teamtreehouse.com/library/css-basics/the-box-model/display-values

Ah, I see. Actually, you don't need any borders for the background color to be visible!

I think this part is confusing because Guil has the background color only set on the anchor, which is inside the li. If the li had the background color, it would show the background all the way to the border.

I hope this helps!