In this plunk I have an Angular UI dropdown list with a maximum height for the selection list. This works fine, and the user can scroll through the list.
I also set the maximum width, as the list is too wide, but this doesn't work. Any ideas how to fix it?
HTML
<div class="btn-group" uib-dropdown>
<button id="btn-append-to-body" type="button" class="btn btn-primary"
uib-dropdown-toggle="">
{{selection}} <span class="caret"></span>
</button>
<ul class="dropdown-menu" uib-dropdown-menu="" role="menu"
style="max-height:80px;max-width:20px;overflow-y:auto"
aria-labelledby="btn-append-to-body">
<li role="menuitem">
<a href="#" ng-click="selectItem('1')">1</a>
</li>
<li role="menuitem">
<a href="#" ng-click="selectItem('2')">2</a>
</li>
<li role="menuitem">
<a href="#" ng-click="selectItem('3')">3</a>
</li>
<li role="menuitem">
<a href="#" ng-click="selectItem('4')">4</a>
</li>
<li role="menuitem">
<a href="#" ng-click="selectItem('5')">5</a>
</li>
<li role="menuitem">
<a href="#" ng-click="selectItem('6')">6</a>
</li>
<li role="menuitem">
<a href="#" ng-click="selectItem('7')">7</a>
</li>
</ul>
</div>
If you inspect the styles of the ul using your browser dev tools, you'll see that it has a min-width set to 160px. Set if to a value that is lower than or equal to your max-width, and you'll have what you want.