Bootstrap horizontal drop down

前端 未结 5 1979
半阙折子戏
半阙折子戏 2020-12-17 19:33

Take a look at this picture:

I want the dropdown menu items to be stack from left to right (horizontally). I cannot seem get this to work, tried using \"l

5条回答
  •  醉话见心
    2020-12-17 20:24

    Enclose those li into a ul list and the class as list-inline like this

    
    

    Check this screenshot

    enter image description here

    Here is the JSFiddle

    Updates1:

    As I mentioned in comments, class: dropdown-menu has the min-width as 160px. Hence it is fixed to width. Try to override it.

    enter image description here

    Updates2:

    As I mentioned in comments, bootstrap has some default style which can be overridden like

    .dropdown-menu{
    min-width: 200px;
    }
    

    Incase if you feel that it affects other elements then override using id selector.

    #Numberlist.dropdown-menu{
    min-width: 200px;
    }
    

    Find the difference in this JSFiddle

提交回复
热议问题