HTML CSS LI Wrapping

Craig picture Craig · Nov 17, 2008 · Viewed 79.1k times · Source

I have a vertical menu in my system which is basically made of HTML ul/li with CSS styling (see image below). However I don't want the li items which are wider than the menu to wrap, I would prefer them to overflow with a horizontal scroll bar at the bottom of the menu. How can I do this in CSS?

Answer

Owen picture Owen · Nov 17, 2008
ul {
  overflow: auto;  // allow li's to overflow w/ scroll bar
                   // at the bottom of the menu
}

li {
  white-space: nowrap; // stop the wrapping in the first place
}