Bootstrap Dropdown Menu

In the Bootstrap documentation, there are two different ways to create a drop-down list:

  • .dropdown
  • .btn-group

the first is as follows:

 <div class="dropdown"> <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"> Dropdown <span class="caret"></span> </button> <ul class="dropdown-menu" aria-labelledby="dropdownMenu1"> ... </ul> </div> 

second is as follows:

 <div class="btn-group"> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> Dropdown <span class="caret"></span> </button> <ul class="dropdown-menu"> ... </ul> </div> 

Is one method preferable to another?

+5
source share
1 answer

They are basically the same, using the btn group is so that you can get the buttons on one line using another button or another form element.

+6
source

Source: https://habr.com/ru/post/1241957/


All Articles