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

Is inline-block necessary for the list items?

Is Inline-block necessary for the list-items? the li's don't have any height or width explicitly defined. Tried just inline and it worked

2 Answers

inline-block is necessary for adding top/bottom margins and padding to the links and declaring the height, as well as a couple other things. You get a little more control over the list items with it. You might not always need it. :)

Thanks Ryan!

Does that mean you can't add top/bottom margin to links if it is "display: inline"

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

There are other ways, such as puttng a float left on all your list items such as

ul  li  {
  float: left;
  padding-right; 15px;

}

would put list items left to right rather than on top of each other. But inline-block for me does the job better. :-)