First you need to set the drop-down menu to 100% width and place it all the way to the left.
.yamm .container .dropdown-menu { left: 0; width: 100%; }
For this, the .container should not have the position: relative that it has, otherwise the drop-down menu will always be located only on the left border of the container. So:
.yamm .container { position: static; }
Then you need to make sure that the insides of the drop-down list are as wide as necessary, and center them. You can do this by setting it to display: inline-block . Now it will occupy the same width as required, and not the full width of the page. However, it is left aligned, so add text-align: center to .dropdown-menu to center the content.
Final result:
.yamm .container { position: static; } .yamm .container .dropdown-menu { left: 0; text-align: center; width: 100%; } .yamm .dropdown-menu > li { display: inline-block; }
JsFiddle work: http://jsfiddle.net/DHQfz/18/
source share