Bootstrap4 表单控件

Bootstrap4 教程 · 2019-03-02 09:27:20

Bootstrap4 支持以下表单控件:

  • input
  • textarea
  • checkbox
  • radio
  • select

Bootstrap Input

Bootstrap 支持所有的 HTML5 输入类型: text, password, datetime, datetime-local, date, month, time, week, number, email, url, search, tel, 以及 color。

注意:: 如果 input 的 type 属性未正确声明,输入框的样式将不会显示。

以下实例使用两个 input 元素,一个是 text,一个是 password :

实例
<div class="form-group"> <label for="usr">用户名:</label> <input type="text" class="form-control" id="usr"> </div> <div class="form-group"> <label for="pwd">密码:</label> <input type="password" class="form-control" id="pwd"> </div>

Bootstrap textarea

以下实例演示了 textarea 的样式。

实例
<div class="form-group"> <label for="comment">评论:</label> <textarea class="form-control" rows="5" id="comment"></textarea> </div>

Bootstrap 复选框(checkbox)

复选框用于让用户从一系列预设置的选项中进行选择,可以选一个或多个。

以下实例包含了三个选项。最后一个是禁用的:

实例
<div class="form-check"> <label class="form-check-label"> <input type="checkbox" class="form-check-input" value="">Option 1 </label> </div> <div class="form-check"> <label class="form-check-label"> <input type="checkbox" class="form-check-input" value="">Option 2 </label> </div> <div class="form-check disabled"> <label class="form-check-label"> <input type="checkbox" class="form-check-input" value="" disabled>Option 3 </label> </div>

使用 .form-check-inline 类可以让选项显示在同一行上:

实例
<div class="form-check form-check-inline"> <label class="form-check-label"> <input type="checkbox" class="form-check-input" value="">Option 1 </label> </div> <div class="form-check form-check-inline"> <label class="form-check-label"> <input type="checkbox" class="form-check-input" value="">Option 2 </label> </div> <div class="form-check form-check-inline disabled"> <label class="form-check-label"> <input type="checkbox" class="form-check-input" value="" disabled>Option 3 </label> </div>

Bootstrap 单选框(Radio)

单选框用于让用户从一系列预设置的选项中进行选择,只能选一个。

以下实例包含了三个选项。最后一个是禁用的:

实例
<div class="radio"> <label><input type="radio" name="optradio">Option 1</label> </div> <div class="radio"> <label><input type="radio" name="optradio">Option 2</label> </div> <div class="radio disabled"> <label><input type="radio" name="optradio" disabled>Option 3</label> </div>

使用 .radio-inline 类可以让选项显示在同一行上:

实例
<label class="radio-inline"><input type="radio" name="optradio">Option 1</label> <label class="radio-inline"><input type="radio" name="optradio">Option 2</label> <label class="radio-inline"><input type="radio" name="optradio">Option 3</label>

Bootstrap select 下拉码单

当您想让用户从多个选项中进行选择,但是默认情况下只能选择一个选项时,则使用选择框。

以下实例包含了两个下拉码单:

实例
<div class="form-group"> <label for="sel1">下拉码单:</label> <select class="form-control" id="sel1"> <option>1</option> <option>2</option> <option>3</option> <option>4</option> </select> </div>

点击查看所有 Bootstrap4 教程 文章: https://codercto.com/courses/l/26.html

查看所有标签

商业模式新生代

商业模式新生代

亚历山大•奥斯特瓦德 (Alexander Osterwalder)、伊夫•皮尼厄 (Yves Pigneur) / 王帅、毛心宇、严威 / 机械工业出版社 / 2011-8-15 / 88.00元

中文官网:http://www.bizmodel.org 内容简介:当你愉快的看完第一章:商业模式画布,赫然发现这些构成要素全 都交织成一幅清晰的图像在脑海中呈现,它们如何互相影响、如何交互作用全都历历在目。利用商业模式画布分析瑞士银行、Google、Lego、Wii 、Apple等跨国企业,归纳出三种不同的产业 模式,也涵括新近的热门现象免费效应及长尾理论等。在这些有趣的例子中,我们不仅更......一起来看看 《商业模式新生代》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

MD5 加密
MD5 加密

MD5 加密工具