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

Shadab Khan
Shadab Khan
5,470 Points

display: inline-block | How does this CSS property exactly work?

Hi, I didn't quite get the CSS property display: inline-block . Can someone please explain me that with some example please? Cheers, Shadab Khan

1 Answer

Jamie Reardon
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Jamie Reardon
Treehouse Project Reviewer

Hi, inline-block allows you to display an element on the same line as other elements like the value inline. However, the difference is that, you can set a width and height for the element, and any top and bottom margins/paddings will be able to be set as well.

With the value inline, you are limited with what you can do with the element, it's width is only as wide as its content, and you can only use left/right margin/padding values.