Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS The Solution

Harry Ramli
Harry Ramli
4,831 Points

Why does setting the list element's display to inline instead of inline-block not work for the centering?

I thought header{ text-align: center; } works for both inline and inline-block elements. Aside from padding, margin, width, height properties, what other differences do inline and inline-block have?

Thank you in advance!

andres garcia
andres garcia
3,111 Points

the major difference is that display: inline-block does not add a line-break after the element, so the element can sit next to other elements.

1 Answer

Visiting this link has helped me so much in clarifying about block elements:


Maybe it can help you also.