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
Akhter Rasool
8,597 Pointsdisplay :inline, block, block-inline
what's the difference between:
1)display:inline; 2)display:inline-block; 3)display:block;
1 Answer
Tobias Helmrich
31,604 PointsHey Akhter,
inline: An inline element is as the name implies inline with other elements. It only takes up as much space as it needs. However you can't set a height or a width for an inline element - it will just be ignored.
inline-block: inline-block elements are very similar to inline elements, so they also just take up as much space as they need and elements can be to their left and right because they are "inline". In contrast to inline elements you can set a height and a width.
block: Block elements by default take up as much horizontal space as they can get and by that they force a line break after them.
But I think you should read this article because I think it explains those values way better than me. :)