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!

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) The Box Model Display Values

Brad Lacke
Brad Lacke
7,438 Points

Display property of the .callout links

Am I correct in saying that the main reason for styling the .callout links as "inline-block" elements is so that we can apply the top margin?

2 Answers

Jesus Mendoza
Jesus Mendoza
23,287 Points

Inline-Block lets you manipulate the container as a Block element, but at the same time it acts like an inline element. The most noticable properties that can be applied to inline-block elements that can't be applied to inline elements can be width, height, margins and paddings.

inline element can be applied with padding, but the padding won't affect other surrounding elements' position.

Jesus Mendoza
Jesus Mendoza
23,287 Points

Yeah but the top and bottom padding does not affect inline elements

for top margin and bottom margin it doesn't affect, for top padding and bottom padding, it does.

Sunshine Khawaja
Sunshine Khawaja
1,845 Points

I think in this example you are exactly right. The margins applied seems to be the only obvious reason for adding the display: inline-block;.