Set the li
elements to display: block
and float them.
/* changes */
li {
display: block;
margin-right: 2px; /*if you want the space*/
float: left;
}
Fiddle: http://jsfiddle.net/mKeAL/
EDIT 1
Looks like this is a whitespace/display-inline bug of some sort with jquery UI.
General bugginess reported here: http://bugs.jqueryui.com/ticket/6942
Author replied 'works for me', pointing at this working fiddle http://jsfiddle.net/T8gkC/ but note the whitespace on the list items in the HTML. I remember an IE5.5 (6) bug that had a similar resolution. If you make the HTML "normal", the bug is back: http://jsfiddle.net/94Vs2/ Adding margin to the list items helps a tiny bit but if you look closely, the bug is still there.
So... if you need them to be display: inline-block
you might try removing the white space in between each <li>
.
EDIT 2
According to the answer at A Space between Inline-Block List Items you can also set a font-size
of 0 on the ul
and reset it on the li
: http://jsfiddle.net/YsG6S/2/ Works fine, margin wise. That said, note the difference in drag/drop/sort interactions with the block/float
method vs any of the inline-block
methods.
EDIT 3
Another option is to drink mightily from the HTML5 fountain and omit your closing </li>
tags. http://jsfiddle.net/mKeAL/1/