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 How to Make a Website Styling Web Pages and Navigation Build Navigation with Unordered Lists

Davide Pupparo
Davide Pupparo
8,452 Points

Display: inline-block or float: left?

Hi there! Why is Nick using display: inline block on the navigation items instead of floating them to the left? What are the advantages of one technique over the other? I'm guessing the fact that giving display:inline-block doesn't force us to re-set a width for the li elements... Am I right? sorry for my english ^___O

3 Answers

Kazimierz Matan
Kazimierz Matan
13,257 Points

Great explanation here. Also a discussion here.

I have always wonder the same thing. I have the habit of floating my divs left.

Davide Pupparo
Davide Pupparo
8,452 Points

Me too. Altough Nic's solution seems to be a good alternative. I'm just wondering about what could be the cons of that approach