0

I want to start horizontally wrapped li texts in line, now it goes upward. Please see my example

HTML

  <ul>
  <li>Long text goes here.</li>
  <li>Another Longer Text Goes Here</li>
  <li>Shorter text</li>
  </ul>

CSS

ul {width:150px;}
li {width:30%; display:inline-block;whitespace:pre-line;}   

http://jsfiddle.net/wbu9ksco/

Thank you.

Enkhtuvshin
  • 67
  • 2
  • 12
  • There's also a nice explanation here: http://stackoverflow.com/questions/9273016/why-is-this-inline-block-element-pushed-downward you might want to consider. – Hashem Qolami Sep 03 '14 at 20:09

2 Answers2

3

Use vertical align:

li {
   vertical-align: text-top;
}

Updated fiddle

John Slegers
  • 45,213
  • 22
  • 199
  • 169
Morpheus
  • 8,829
  • 13
  • 51
  • 77
0

since you are using inline-block attribute for your li elements, you can use vertical-align to line them up;

li {
    vertical-align: text-top;
}
Stan
  • 121
  • 5