I came across a problem with displaying the list in FF (it works fine in Chrome / IE). The problem is that when overflow: auto in FF, the scrollbar eats the longest item in the list, as if it puts a scrollbar on top of the list and does not attach it to the side in IE or Chrome. overflow-y: scroll solves the problem, but in this case the scrollbar will be displayed constantly, even when it is not needed functionally, and this is unacceptable in my case. white-space: nowrap also needed, because on demand you need to display elements in one line. The width of the div element is also desirable to leave on width: auto .
div { display: block; min-width: 40px; width: auto; position: absolute; top: 50px; left: 100px; background: #fff; z-index: 102; max-height: 100px; overflow-y: auto; overflow-x: visible; border-radius: 5px; box-shadow: 0px 5px 60px -7px #808e95; padding: 20px 10px; margin: 5px 0 0; } ul { overflow: hidden; white-space: nowrap; list-style: none; margin: 0; padding: 0; } <div> <ul> <li>Element</li> <li>Element</li> <li>Element</li> <li>Element</li> <li>Element</li> <li>Element</li> <li>REALLY BIG ELEMENT INSERTED HERE!</li> <li>Element</li> <li>Element</li> <li>Element</li> <li>Element</li> <li>Element</li> <li>Element</li> </ul> </div> In general, can you somehow solve this without resorting to JS crutches?