1

Iam wondering if it is a way to force overflow elements of an fixed container to be on the same line instead of going on a new line.

http://jsfiddle.net/vrSRE/3/

Thank you.

jeremymarc
  • 513
  • 3
  • 15

2 Answers2

3

Yes, there's a way.

You have to replace, float: left with display: inline-block, and add white-space: nowrap to the parent element:

See: http://jsfiddle.net/vrSRE/4/

ul {
    width: 300px;
    height: 30px;
    background: red;
    white-space: nowrap
}
li {
    display: inline-block
}

If you don't want any space between the elements, the easiest way to fix this new problem is to remove the whitespace in the HTML, like this:

For other options that you probably don't care about to remove the space, see:

And lastly, if you care about IE7 support, use this:

Community
  • 1
  • 1
thirtydot
  • 224,678
  • 48
  • 389
  • 349
1

See: http://jsfiddle.net/keBFd/

You can use white-space: nowrap and display: inline - you might not want display: inline, though.

Ry-
  • 218,210
  • 55
  • 464
  • 476