【Bootstrap 4】按鈕組
阿新 • • 發佈:2019-01-04
Table of Contents
設定按鈕組大小(.btn-group-lg/.btn-group-sm)
Table of Contents
設定按鈕組大小(.btn-group-lg/.btn-group-sm)
建立按鈕組(.btn-group)
設定按鈕組大小(.btn-group-lg/.btn-group-sm)
設定按鈕組垂直(.btn-group-vertical)
<div class="btn-group btn-group-lg btn-group-vertical"> <button type="button" class="btn btn-primary">Apple</button> <button type="button" class="btn btn-primary">Samsung</button> <button type="button" class="btn btn-primary">Sony</button> </div>
內嵌按鈕組及下拉選單
<div class="btn-group"> <button type="button" class="btn btn-primary">Apple</button> <button type="button" class="btn btn-primary">Samsung</button> <div class="btn-group"> <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown"> Sony </button> <div class="dropdown-menu"> <a class="dropdown-item" href="#">Tablet</a> <a class="dropdown-item" href="#">SmartPhone</a> </div> </div> </div>
拆分按鈕下拉選單
<div class="btn-group">
<button type="button" class="btn btn-primary">Sony</button>
<button type="button"
class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown">
<span class="caret"></span>
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="#">Tablet</a>
<a class="dropdown-item" href="#">Smartphone</a>
</div>
</div>
垂直按鈕組及下拉選單
<div class="btn-group-vertical">
<button type="button" class="btn btn-primary">Apple</button>
<button type="button" class="btn btn-primary">Samsung</button>
<div class="btn-group">
<button type="button" class="btn btn-primary dropdown-toggle"
data-toggle="dropdown">
Sony
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="#">Tablet</a>
<a class="dropdown-item" href="#">SmartPhone</a>
</div>
</div>
</div>