引导程序4样式选择 [英] bootstrap 4 styled select
问题描述
我想显示一个下拉列表/选择作为bootstrap 4的输入.到目前为止,我在文档ist
i would like to display a dropdown / select as an input with bootstrap 4. so far the only select thing i found in the documentation ist this. which works, but does not look very bootstrap like and does not support icons, grouping dividers and stuff. is there any way to fit a select with the functionality of a dropdown from bootstrap?
类似这样的东西,但仅作为形式的输入:
something like this, but only as form input of sorts:
<div class="btn-group">
<button class="btn btn-secondary btn-lg dropdown-toggle" type="button" data-toggle="dropdown">
Large button
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Separated link</a>
</div>
</div>
有人有主意吗?
推荐答案
select
元素的样式/格式设置能力通常受到限制,而不仅限于Bootstrap.这就是为什么有第三方插件,例如 https://github.com/silviomoreto/bootstrap-select利用jQuery将现有的select元素转换为样式,并为标准select元素带来附加功能".
The ability to style/format the select
element is limited in general, not just in Bootstrap. That's why there are 3rd party plugins such as https://github.com/silviomoreto/bootstrap-select which utilize jQuery to convert an existing select element to "style and bring additional functionality to standard select elements".
您还可以添加一些简单的jQuery,以使Bootstrap下拉列表的行为类似于select元素: http://www.codeply.com/go/ganazCDXB5
You can also add some simple jQuery to make the Bootstrap dropdown behave like a select element: http://www.codeply.com/go/ganazCDXB5
更新2019-Bootstap 4