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

Shaked Gvirtsman
Shaked Gvirtsman
2,270 Points

Why do we use "display: inline-block;"

I'm a bit confused, why do we use

display: inline-block;

2 Answers

Aakash Srivastava
Aakash Srivastava
5,415 Points

Hey Shaked Gvirtsman ,
We can not set top and bottom margins on inline elements because inline elements flow with content on the page. You can set left and right margins/padding on an inline element but not top or bottom because it would disrupt the flow of content.
That's why Guil converted them into an inline-block so that he can apply those properties to them .
Setting an element to inline-block gives your more freedom to style them .