【Bootstrap V4系列】学习入门教程之 组件-输入组(Input group)
Bootstrap V4系列 学习入门教程之 组件-输入组(Input group)
- 输入组(Input group)
- Basic example
- 一、Wrapping 包装
- 二、Sizing 尺寸
- 三、Multiple addons 多个插件
- 四、Button addons 按钮插件
- 五、Buttons with dropdowns 带下拉按钮
- 六、Custom forms 自定义表单
- 6.1 Custom select 自定义选择
- 6.2 Custom file input 自定义文件输入
输入组(Input group)
通过在文本输入、自定义选择和自定义文件输入的任一侧添加文本、按钮或按钮组,可以轻松扩展表单控件。
Basic example
在输入的两侧放置一个插件或按钮。您也可以在输入的两侧放置一个。记住将<label>
s放在输入组之外。
<!--Basic example-->
<div class="input-group mb-3"><div class="input-group-prepend"><span class="input-group-text" id="basic-addon1">@</span></div><input type="text" class="form-control" placeholder="Username" aria-label="Username" aria-describedby="basic-addon1">
</div><div class="input-group mb-3"><input type="text" class="form-control" placeholder="Recipient's username" aria-label="Recipient's username" aria-describedby="basic-addon2"><div class="input-group-append"><span class="input-group-text" id="basic-addon2">@example.com</span></div>
</div><label for="basic-url">Your vanity URL</label>
<div class="input-group mb-3"><div class="input-group-prepend"><span class="input-group-text" id="basic-addon3">https://example.com/users/</span></div><input type="text" class="form-control" id="basic-url" aria-describedby="basic-addon3">
</div><div class="input-group mb-3"><div class="input-group-prepend"><span class="input-group-text">$</span></div><input type="text" class="form-control" aria-label="Amount (to the nearest dollar)"><div class="input-group-append"><span class="input-group-text">.00</span></div>
</div><div class="input-group"><div class="input-group-prepend"><span class="input-group-text">With textarea</span></div><textarea class="form-control" aria-label="With textarea"></textarea>
</div>
页面展示效果:
一、Wrapping 包装
默认情况下,输入组通过flex-wrap:wrap
进行包装,以适应输入组内的自定义表单字段验证。您可以使用.flex-nowrap
禁用此功能。
<div class="input-group flex-nowrap"><div class="input-group-prepend"><span class="input-group-text" id="addon-wrapping">@</span></div><input type="text" class="form-control" placeholder="Username" aria-label="Username" aria-describedby="addon-wrapping">
</div>
页面展示效果:
二、Sizing 尺寸
将相对的表单大小类添加到.input-group
组本身,其中的内容将自动调整大小——不需要在每个元素上重复表单控件大小类。
不支持对单个输入组元素进行大小调整。
<div class="input-group input-group-sm mb-3"><div class="input-group-prepend"><span class="input-group-text" id="inputGroup-sizing-sm">Small</span></div><input type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-sm">
</div><div class="input-group mb-3"><div class="input-group-prepend"><span class="input-group-text" id="inputGroup-sizing-default">Default</span></div><input type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-default">
</div><div class="input-group input-group-lg"><div class="input-group-prepend"><span class="input-group-text" id="inputGroup-sizing-lg">Large</span></div><input type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-lg">
</div>
页面展示效果:
三、Multiple addons 多个插件
支持多个附加组件,可以与复选框和单选框输入版本混合使用。
<div class="input-group mb-3"><div class="input-group-prepend"><span class="input-group-text">$</span><span class="input-group-text">0.00</span></div><input type="text" class="form-control" aria-label="Dollar amount (with dot and two decimal places)">
</div><div class="input-group"><input type="text" class="form-control" aria-label="Dollar amount (with dot and two decimal places)"><div class="input-group-append"><span class="input-group-text">$</span><span class="input-group-text">0.00</span></div>
</div>
页面展示效果:
四、Button addons 按钮插件
<div class="input-group mb-3"><div class="input-group-prepend"><button class="btn btn-outline-secondary" type="button" id="button-addon1">Button</button></div><input type="text" class="form-control" placeholder="" aria-label="Example text with button addon" aria-describedby="button-addon1">
</div><div class="input-group mb-3"><input type="text" class="form-control" placeholder="Recipient's username" aria-label="Recipient's username" aria-describedby="button-addon2"><div class="input-group-append"><button class="btn btn-outline-secondary" type="button" id="button-addon2">Button</button></div>
</div><div class="input-group mb-3"><div class="input-group-prepend" id="button-addon3"><button class="btn btn-outline-secondary" type="button">Button</button><button class="btn btn-outline-secondary" type="button">Button</button></div><input type="text" class="form-control" placeholder="" aria-label="Example text with two button addons" aria-describedby="button-addon3">
</div><div class="input-group"><input type="text" class="form-control" placeholder="Recipient's username" aria-label="Recipient's username with two button addons" aria-describedby="button-addon4"><div class="input-group-append" id="button-addon4"><button class="btn btn-outline-secondary" type="button">Button</button><button class="btn btn-outline-secondary" type="button">Button</button></div>
</div>
页面展示效果:
五、Buttons with dropdowns 带下拉按钮
<div class="input-group mb-3"><div class="input-group-prepend"><button class="btn btn-outline-secondary dropdown-toggle" type="button" data-toggle="dropdown" aria-expanded="false">Dropdown</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 role="separator" class="dropdown-divider"></div><a class="dropdown-item" href="#">Separated link</a></div></div><input type="text" class="form-control" aria-label="Text input with dropdown button">
</div><div class="input-group"><input type="text" class="form-control" aria-label="Text input with dropdown button"><div class="input-group-append"><button class="btn btn-outline-secondary dropdown-toggle" type="button" data-toggle="dropdown" aria-expanded="false">Dropdown</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 role="separator" class="dropdown-divider"></div><a class="dropdown-item" href="#">Separated link</a></div></div>
</div>
页面展示效果:
六、Custom forms 自定义表单
输入组包括对自定义选择和自定义文件输入的支持。不支持这些的浏览器默认版本。
6.1 Custom select 自定义选择
<div class="input-group mb-3"><div class="input-group-prepend"><label class="input-group-text" for="inputGroupSelect01">Options</label></div><select class="custom-select" id="inputGroupSelect01"><option selected>Choose...</option><option value="1">One</option><option value="2">Two</option><option value="3">Three</option></select>
</div><div class="input-group mb-3"><select class="custom-select" id="inputGroupSelect02"><option selected>Choose...</option><option value="1">One</option><option value="2">Two</option><option value="3">Three</option></select><div class="input-group-append"><label class="input-group-text" for="inputGroupSelect02">Options</label></div>
</div><div class="input-group mb-3"><div class="input-group-prepend"><button class="btn btn-outline-secondary" type="button">Button</button></div><select class="custom-select" id="inputGroupSelect03" aria-label="Example select with button addon"><option selected>Choose...</option><option value="1">One</option><option value="2">Two</option><option value="3">Three</option></select>
</div><div class="input-group"><select class="custom-select" id="inputGroupSelect04" aria-label="Example select with button addon"><option selected>Choose...</option><option value="1">One</option><option value="2">Two</option><option value="3">Three</option></select><div class="input-group-append"><button class="btn btn-outline-secondary" type="button">Button</button></div>
</div>
页面展示效果:
6.2 Custom file input 自定义文件输入
此示例使用自定义文件浏览器组件,该组件依赖于单独的
bs-custom-file-input
自定义文件输入插件。
<div class="input-group mb-3"><div class="input-group-prepend"><span class="input-group-text" id="inputGroupFileAddon01">Upload</span></div><div class="custom-file"><input type="file" class="custom-file-input" id="inputGroupFile01" aria-describedby="inputGroupFileAddon01"><label class="custom-file-label" for="inputGroupFile01">Choose file</label></div>
</div><div class="input-group mb-3"><div class="custom-file"><input type="file" class="custom-file-input" id="inputGroupFile02"><label class="custom-file-label" for="inputGroupFile02" aria-describedby="inputGroupFileAddon02">Choose file</label></div><div class="input-group-append"><span class="input-group-text" id="inputGroupFileAddon02">Upload</span></div>
</div><div class="input-group mb-3"><div class="input-group-prepend"><button class="btn btn-outline-secondary" type="button" id="inputGroupFileAddon03">Button</button></div><div class="custom-file"><input type="file" class="custom-file-input" id="inputGroupFile03" aria-describedby="inputGroupFileAddon03"><label class="custom-file-label" for="inputGroupFile03">Choose file</label></div>
</div><div class="input-group"><div class="custom-file"><input type="file" class="custom-file-input" id="inputGroupFile04" aria-describedby="inputGroupFileAddon04"><label class="custom-file-label" for="inputGroupFile04">Choose file</label></div><div class="input-group-append"><button class="btn btn-outline-secondary" type="button" id="inputGroupFileAddon04">Button</button></div>
</div>
页面展示效果:
自定义文件输入插件:
<script src="https://cdn.jsdelivr.net/npm/bs-custom-file-input/dist/bs-custom-file-input.js"></script>
您应该等待文档就绪事件,并调用init方法使您的自定义文件输入动态。我们公开了一个随处可用的全局变量:bsCustomFileInput
<script>$(document).ready(function () {bsCustomFileInput.init()})
</script>
一切准备就绪后,你应该看到页面的上传效果:
相关文章:

【Bootstrap V4系列】学习入门教程之 组件-输入组(Input group)
Bootstrap V4系列 学习入门教程之 组件-输入组(Input group) 输入组(Input group)Basic example一、Wrapping 包装二、Sizing 尺寸三、Multiple addons 多个插件四、Button addons 按钮插件五、Buttons with dropdowns 带下拉按钮…...

VS “筛选器/文件夹”
每天学习一个VS小技巧: 我在VS创建筛选器的时候,想要想要同步计算机上的文件目录,但是发现并未 同步。 例如我在这儿创建了一个筛选器IoManager 但是在UI这个文件夹里并未创建对应的IoManager文件夹 我右击也没有打开文件所在位置 然后我…...
RAG与语义搜索:让大模型成为测试工程师的智能助手
引言 AI大模型风头正劲,自动生成和理解文本的能力让无数行业焕发新生。测试工程师也不例外——谁不想让AI自动“看懂需求、理解接口、生成用例”?然而,很多人发现:直接丢问题给大模型,答案貌似“懂行”,细…...
从 JMS 到 ActiveMQ:API 设计与扩展机制分析(三)
三、ActiveMQ API 设计解析 (一)对 JMS API 的实现与扩展 ActiveMQ 作为 JMS 规范的一种实现,全面且深入地实现了 JMS API,确保了其在 Java 消息服务领域的兼容性和通用性。在核心接口实现方面,ActiveMQ 对 JMS 的 C…...

powerbuilder9.0中文版
经常 用这个版本号写小软件,非常喜欢这个开发软件 . powerbuilder9.0 非常的小巧,快捷,功能强大,使用方便. 我今天用软件 自己汉化了一遍,一些常用的界面都已经翻译成中文。 我自己用的,以后有什么界面需要翻译,再更新一下。 放在这里留个…...
小程序消息订阅的整个实现流程
以下是微信小程序消息订阅的完整实现流程,分为 5个核心步骤 和 3个关键注意事项: 一、消息订阅完整流程 步骤1:配置订阅消息模板 登录微信公众平台进入「功能」→「订阅消息」选择公共模板或申请自定义模板,获取模板IDÿ…...
互联网大厂Java求职面试实战:Spring Boot微服务与数据库优化详解
💪🏻 1. Python基础专栏,基础知识一网打尽,9.9元买不了吃亏,买不了上当。 Python从入门到精通 😁 2. 毕业设计专栏,毕业季咱们不慌忙,几百款毕业设计等你选。 ❤️ 3. Python爬虫专栏…...

基于C语言的TCP通信测试程序开发指南
一、TCP通信基础原理 1.1 通信流程概述 TCP通信采用客户端-服务器模型,核心流程如下: 服务器端: 创建套接字(Socket) 绑定地址和端口(Bind) 开始监听(Listen) 接受…...
Git 分支指南
什么是 Git 分支? Git 分支是仓库内的独立开发线,你可以把它想象成一个单独的工作空间,在这里你可以进行修改,而不会影响主分支(或 默认分支)。分支允许开发者在不影响项目实际版本的情况下,开…...

教育系统源码如何支持白板直播与刷题功能?功能开发与优化探索
很多行业内同学疑问,如何在教育系统源码中支持白板直播和刷题功能?本篇文章,小编将从功能设计、技术实现到性能优化,带你全面了解这个过程。 一、白板直播功能的核心需求与技术挑战 实时交互与同步性 白板直播的核心是“实时性”。…...
SSM框架整合MyBatis-Plus的步骤和简单用法示例
以下是 SSM框架整合MyBatis-Plus的步骤 和 简单用法示例: 一、SSM整合MyBatis-Plus步骤 1. 添加依赖(Maven) <?xml version"1.0" encoding"UTF-8"?> <project xmlns"http://maven.apache.org/POM/4.0.…...
【LeetCode 热题 100】206. 反转链表
📌 难度:简单 📚 标签:链表、双指针、迭代、递归 🔗 题目链接(LeetCode CN) 🧩 一、题目描述 给你单链表的头节点 head,请你反转链表,并返回反转后的链表。 ✅…...
centos8.5.2111 更换阿里云源
使用前提是服务器可以连接互联网 1、备份现有软件配置文件 cd /etc/yum.repos.d/ mkdir backup mv CentOS-* backup/ 2、下载阿里云的软件配置文件 wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo 3、清理并重建…...

再度深入理解PLC的输入输出接线
本文再次重新梳理: 两线式/三线式传感器的原理及接线、PLC的输入和输出接线,深入其内部原理,按照自己熟悉的方式去理解该知识 在此之前,需要先统一几个基础知识点: 在看任何电路的时候,需要有高低电压差&…...

k8s(11) — 探针和钩子
钩子和探针的区别: 在 Kubernetes(k8s)中,钩子(Hooks)和探针(Probes)是保障应用稳定运行的重要机制,不过它们的用途和工作方式存在差异,以下为你详细介绍&…...

使用jmeter对数据库进行压力测试
🍅 点击文末小卡片 ,免费获取软件测试全套资料,资料在手,涨薪更快 前言 很多人提到 jmeter时,只会说到jmeter进行接口自动化或接口性能测试,其实jmeter还能对数据库进行自动化操作。个人常用的场景有以下&…...
Scala与Go的异同教程
当瑞士军刀遇到电锯:Scala vs Go的相爱相杀之旅 各位准备秃头的程序猿们(放心,用Go和Scala不会加重你的发际线问题),今天我们来聊聊编程界的"冰与火之歌"——Scala和Go的异同。准备好瓜子饮料,我…...
LeetCode 热题 100 138. 随机链表的复制
LeetCode 热题 100 | 138. 随机链表的复制 大家好,今天我们来解决一道经典的链表问题——随机链表的复制。这道题在 LeetCode 上被标记为中等难度,要求深拷贝一个带有随机指针的链表。 问题描述 给你一个长度为 n 的链表,每个节点包含一个额…...

Kubernetes生产实战(十四):Secret高级使用模式与安全实践指南
一、Secret核心类型解析 类型使用场景自动管理机制典型字段Opaque (默认)自定义敏感数据需手动创建data字段存储键值对kubernetes.io/dockerconfigjson私有镜像仓库认证kubelet自动更新.dockerconfigjsonkubernetes.io/tlsTLS证书管理Cert-Manager可自动化tls.crt/tls.keykube…...

05 mysql之DDL
一、SQL的四个分类 我们通常可以将 SQL 分为四类,分别是: DDL(数据定义语言)、DML(数据操作语言)、 DCL(数据控制语言)和 TCL(事务控制语言)。 DDL 用于创建…...

电池热管理CFD解决方案,为新能源汽车筑安全防线
在全球能源结构加速转型的大背景下,新能源汽车产业异军突起,成为可持续发展的重要驱动力。而作为新能源汽车 “心脏” 的电池系统,其热管理技术的优劣,直接决定了车辆的安全性、续航里程和使用寿命。电池在充放电过程中会产生大量…...
使用互斥锁保护临界
Linux线程互斥及相关概念解析 1. 临界资源(Critical Resource) 定义:被多个线程共享的资源(如变量、文件、内存区域等),需通过互斥访问确保数据一致性。特点: 共享性:多个线程可能…...
Android第三次面试总结之网络篇补充
一、网络模型:OSI 七层 vs TCP/IP 四层(必考点) 1. 分层模型对比 OSI 七层模型TCP/IP 四层模型核心功能Android 相关场景应用层(7 层)应用层定义数据格式(HTTP/HTTPS/FTP/API)OkHttp/Retrofit…...
网络世界的“快递站”:深入浅出OSI七层模型
网络世界的“快递站”:OSI七层模型的奇妙旅程 为什么需要OSI七层模型? 想象一下,你正在给朋友寄一份生日礼物。你需要先包装礼物、贴上地址标签、选择快递公司、支付运费,最后把包裹交给快递员。这个过程看似简单,但…...
使用 Apache POI 生成包含文本和图片的 Word 文档
一、概述 在实际开发场景中,我们经常需要自动生成包含文本和图片的 Word 文档。本示例借助 Apache POI 库,实现了向 Word 文档中插入文本和图片的功能。代码会循环插入多次文本和同一张图片,并且对图片进行等比缩放处理,以保证图片…...

TransmittableThreadLocal:穿透线程边界的上下文传递艺术
文章目录 前言一、如何线程上下文传递1.1 ThreadLocal单线程1.2 InheritableThreadLocal的继承困境1.3 TTL的时空折叠术 二、TTL核心设计解析2.1 时空快照机制2.2 装饰器模式2.3 采用自动清理机制 三、设计思想启示四、实践启示录结语 前言 在并发编程领域,线程上下…...

基于STM32的甲醛检测
一、制作目标 以正点原子的miniSTM32F103RCT6开发板为主控,使用甲醛传感器检测环境空气中的甲醛含量(以mg/m^3为单位)、C02含量(以ppm为单位)和总有机挥发物含量TVOC(以mg/m^3为单位)在OLED显示…...

洛图报告中的 FSHD 是什么?—— 解密九天画芯推动的三色光源显示技术
目录 一、洛图报告新焦点:FSHD 为何成为显示产业重要突破方向? (一)洛图报告核心结论:从技术突围到产业重构 二、技术解析:FSHD 如何重构显示底层逻辑? (一)物理架构…...
含锡电镀废水深度净化技术体系解析化利用的全流程优化
一、含锡电镀废水的产生机理与污染特征 含锡电镀废水主要形成于三个关键生产环节:镀槽液定期置换排放、镀件后处理清洗水以及车间地面冲洗水。其中,清洗水作为电镀工艺的附属产物,承担着清除镀层表面残留镀液的重要功能;冲刷废水则…...

【MySQL】事务(重点)
目录 一、什么是事务: 二、事务的前置知识了解 引擎是否支持事务 事务的提交方式 事务操作的前置准备: 三、事务回滚: 四、事务崩溃: 原子性: 持久性: 五、自动提交和手动提交: 六、…...