Back to Freecodecamp

Learn Block and Inline Lesson E

curriculum/challenges/english/blocks/top-learn-block-and-inline/6570447fe7b02272663824e3.md

latest973 B
Original Source

--description--

Inline-block elements behave like inline elements, but with block-style padding and margin. display: inline-block is a useful tool to know about, but in practice, you'll probably end up reaching for flexbox more often if you're trying to line up a bunch of boxes. Flexbox will be covered in-depth in the next lesson.

--questions--

--text--

What is the difference between an inline element and an inline-block element?

--answers--

inline elements are displayed without line breaks, while inline-block elements are displayed with line breaks.


inline elements do not allow setting width and height, while inline-block elements allow setting width and height.


inline elements are always positioned horizontally, while inline-block elements are positioned vertically.


inline elements can contain block-level elements, while inline-block elements cannot contain other elements.

--video-solution--

2