Select menus are used if you want to allow the user to pick from multiple options.
To style a select menu in Bootstrap 5, add the .form-select
class to the <select> element:
<select class="form-select">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
</select>
Try it Yourself »
Use the .form-select-lg
or .form-select-sm
class to change the size of the select menu:
<select class="form-select form-select-lg">
<select class="form-select">
<select class="form-select form-select-sm">
Try it Yourself »
Use the disabled
attribute to disable the select menu:
<select class="form-select" disabled>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
</select>
Try it Yourself »
Bootstrap will also style data lists, which is a list of pre-defined options for an <input> element:
<label for="browser" class="form-label">Choose your browser from the list:</label>
<input class="form-control" list="browsers" name="browser" id="browser">
<datalist id="browsers">
<option value="Edge">
<option value="Firefox">
<option value="Chrome">
<option value="Opera">
<option value="Safari">
</datalist>
Try it Yourself »
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!