Question

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?

Was it helpful?

Solution

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
}

OTHER TIPS

Use white-space:nowrap. Like so:

li {
  white-space:nowrap;
}

Here's some documentation.

You would also need to give the style the ul:

ul{
 width:250px;
 overflow:auto;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top