如何使用html css和bootstrap 4创建多检查下拉菜单?

问题描述 投票:1回答:1

我想像Gmail一样创建一个多检查下拉列表。像这样的东西:

enter image description here

我所取得的成就是:

enter image description here

它看起来不太好。

有人可以建议我如何能够接近上面的图像吗?

更新:

为我的多检查下拉列表添加代码。

<th >
                            <div class="dropdown text-center">
                                    <input type='checkbox' value='loadBalancing' [(ngModel)]="selectedAll" (change)="selectAll($event)">
                                    <button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">

                                    </button>
                                    <div class="dropdown-menu" aria-labelledby="dropdownMenuButton" style="margin-left:33%; margin-top: -2%">
                                      <a class="dropdown-item" href="#" (click)="selectAll(true)">SelectAll</a>
                                      <a class="dropdown-item" href="#" (click)="selectAll(false)">None</a>
                                    </div>
                                  </div>
                        </th>
html css angular bootstrap-4
1个回答
0
投票

.btn.dropdown-toggle {
   background: #e2e4e6;
   border: 1px solid #c3c3c3;
   color: #949494;
   padding: 3px 20px;
   border-radius: 0;
}

.btn.dropdown-toggle:focus {
  outline: none;
  box-shadow: none;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

<th >
  <div class="dropdown text-center" role="button">
    <button class="btn dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
    <input type='checkbox' value='loadBalancing' [(ngModel)]="selectedAll" (change)="selectAll($event)">
    </button>
    <div class="dropdown-menu" aria-labelledby="dropdownMenuButton" style="margin-left:33%; margin-top: -2%">
      <a class="dropdown-item" href="#" (click)="selectAll(true)"> SelectAll
      </a>
      <a class="dropdown-item" href="#" (click)="selectAll(false)">None
      </a>
     </div>
  </div>
</th>
© www.soinside.com 2019 - 2024. All rights reserved.