bootstrap中添加额外的图标的方法
- 更新时间:2020-01-31 08:32:20
- 编辑:双志新
说明
可以针对校验状态为输入框添加额外的图标。只需设置相应的 .has-feedback 类并添加正确的图标即可
示例
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! --> <title>Bootstrap 101 Template</title> <!-- Bootstrap --> <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="external nofollow" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script> <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <div class="form-group has-success has-feedback"> <label class="control-label" for="inputSuccess2">Input with success</label> <input type="text" class="form-control" id="inputSuccess2" aria-describedby="inputSuccess2Status"> <span class="glyphicon glyphicon-ok form-control-feedback" aria-hidden="true"></span> <span id="inputSuccess2Status" class="sr-only">(success)</span> </div> <div class="form-group has-warning has-feedback"> <label class="control-label" for="inputWarning2">Input with warning</label> <input type="text" class="form-control" id="inputWarning2" aria-describedby="inputWarning2Status"> <span class="glyphicon glyphicon-warning-sign form-control-feedback" aria-hidden="true"></span> <span id="inputWarning2Status" class="sr-only">(warning)</span> </div> <div class="form-group has-error has-feedback"> <label class="control-label" for="inputError2">Input with error</label> <input type="text" class="form-control" id="inputError2" aria-describedby="inputError2Status"> <span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"></span> <span id="inputError2Status" class="sr-only">(error)</span> </div> <div class="form-group has-success has-feedback"> <label class="control-label" for="inputGroupSuccess1">Input group with success</label> <div class="input-group"> <span class="input-group-addon">@</span> <input type="text" class="form-control" id="inputGroupSuccess1" aria-describedby="inputGroupSuccess1Status"> </div> <span class="glyphicon glyphicon-ok form-control-feedback" aria-hidden="true"></span> <span id="inputGroupSuccess1Status" class="sr-only">(success)</span> </div> </div> <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script> <!-- Include all compiled plugins (below), or include individual files as needed --> <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> </body> </html>
输出
以上所述是小编给大家介绍的bootstrap中添加额外的图标实例代码,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对码农之家网站的支持!
相关教程
-
解决bootstrap中下拉菜单点击后不关闭的问题
今天小编就为大家分享一篇解决bootstrap中下拉菜单点击后不关闭的问题,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
发布时间:2019-06-21
-
利用纯Vue.js构建Bootstrap组件
这篇文章主要介绍了如何使用 Vue.js 和纯 JavaScript 构建 Bootstrap 组件,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
发布时间:2019-07-25
-
基于Bootstrap和Knockout.js的ASP.NET MVC开发实战
通过本书的实践应用,你将可以学习对ASP.NET MVC服务端语言、Bootstrap前端框架和Knockoutjs——Model-View-ViewModel模式的JavaScript实现的组合使用,感兴趣的可以下载了解
大小:33.5 MBASP.NET电子书
-
Bootstrap用户手册:设计响应式网站
Bootstrap是Mark Otto和Jacob Thornton在Twitter公司共同开发的一个网站开发框架,2011年8月发布至今已经成为Github上最受关注的开源项目。从最初CSS驱动的项目到目前内置很多JavaScript插件和图标,并且涵盖表单和按钮元素、支持响应式Web设计
大小:10.7 MBBootstrap电子书
-
BootStrap开发精解:原理、技术、工具及最佳实践
这本书以浅显易懂的方式,帮助大家掌握各种技术诀窍,进而了解Bootstrap的各种复杂细节,详细讲解了Bootstrap中最重要的栅格概念和CSS样式,欢迎下载
大小:30.1 MBBootStrap电子书
-
响应式网页设计:Bootstrap开发速成
本书从认识响应式网页设计与Bootstrap开始,详解网站的开发流程、响应式网页的设计思维、SEO设置以及网页设计趋势,导入视觉设计与网页制作两个不同领域的专业知识,并提供120多个Bootstr
大小:185 MB网页设计电子书
-
Bootstrap实战从入门到精通
本书系统的讲解Bootstrap技术的体系结构、基础知识、组件插件以及各种深度实战应用,适合作为 Bootstrap 入门、Bootstrap 框架、JavaScript 高级程序设计、HTML5移动开发人员的参考书,欢迎下载
大小:115.1 MBBootstrap电子书
-
Bootstrap Web设计与开发实战
本书全面系统地介绍了Bootstrap框架相关技术在Web和移动Web开发领域的应用,通过提供的示例深入理解Bootstrap框架相关的知识点,举一反三,带你轻松学会简洁、直观、强悍的前端开发框架
大小:114.1 MB前端开发电子书
-
基于BootStrap3的JSP项目实例教程
基于BootStrap3的 JSP项目实例教程是作者多年来教学实践经验的总结,汇集了作者在项目中遇到的各种问题及解决方案。感兴趣的可以下载学习
大小:136.6 MBBootStrap3电子书