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 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,113 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:

https://www.w3schools.com/css/tryit.asp?filename=trycss_inline-block_span1

Maybe it can help you also.