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


Displaying items side by side (inline-block)

I am trying to get items (li) in UL to display inline-block

  • I would like the the items (li's) to have a width as a percentages so they become smaller as the page becomes smaller.. Is this the correct approach and how would i go about achieving this? Also, how would i go about spacing the li's in the middle as they are stuck together?

A JSfidddle of the code: https://jsfiddle.net/kL7dxv3s/


1 Answer

You might be better off floating them left depending on what you are trying to do, but have you tried playing with

li {
  display: inline-block;
  width: 10%;

Where 10% is the value you want to adjust?

Here is my current code on JSfiddle to make it easier to answer Would float: left be best then? also, how would i go about spacing the li's in the middle?