bootstrap-添加额外的图标

说明

可以针对校验状态为输入框添加额外的图标。只需设置相应的 .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" 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>

输出

时间: 2024-12-22 07:06:06

bootstrap-添加额外的图标的相关文章

Bootstrap 表单和图片 (内联表单,表单合组,水平排列,复选框和单选框,下拉列表,校验状态,添加额外的图标,控制尺寸,图片)

一.表单 基本格式 注:只有正确设置了输入框的 type 类型,才能被赋予正确的样式. 支持的输入框控件 包括:text.password.datetime.datetime-local.date.month.time.week. number.email.url.search.tel 和 color. <form> <div class="form-group"> <label>电子邮件</label> <input type=&

iOS 给系统的对象添加额外的属性----关联属性

@interface NSObject (Objc) // @property (nonatomic, strong) NSString *name; // 在分类中 给系统的类添加属性, 一搬系统的类不能添加额外的属性 @end #import "NSObject+Objc.h" #import <objc/message.h> @implementation NSObject (Objc) //static NSString *_name; -(void)setName

bootstrap添加多个模态对话框支持

bootstrap添加多个模态对话框支持 (2015-03-04 21:05:35) 转载▼ 标签: 房产   因为项目需要,在页面交互上要弹出多个dialog窗口,而bootstrap的modal支持弹出dialog窗口,但是如果在此基础上,会出现遮罩层越来越多,背景越来越黑的情况. 代码具体如下: (function(){ modal = {}; modal.openDialog = function(url, title, width, height, id){}; modal.close

Ubuntu Dash 添加 Sublime Text 图标

http://blog.csdn.net/johnnycode/article/details/17848291 经常在Ubuntu下安装绿色软件,之前只能将快捷方式放到桌面上,感觉不方便. 其实设置很简单,总结一下,好脑子不如烂笔头! 1.在 /usr/share/applications 目录下增加 sublime.desktop 文件,注意权限! [plain] view plaincopy $ sudo vim /usr/share/applications/sublime_test.d

为网站添加favicon.ico图标

前言 貌似每次都是等到网站快收尾时才做favicon.ico的,这次也不例外.这年代-- 步骤 1.PS制作正方形图标,格式为jpg.jpeg.gif或png. 2.将图标转换为ICO格式,网上有很多在线转换工具,如http://www.ico.la/old.html . 3.将转换好的ICO格式图标放到网站中. 4.网页代码<head></head>之间添加: <link rel="shortcut icon" href="images/fav

maven添加额外archetype

用Eclipse + m2e 插件新建maven项目时发现archetype太少了,网上搜索如何添加额外的archetype. http://maven.apache.org/archetype/maven-archetype-plugin/specification/archetype-catalog.html The Archetype Plugin knows by default about its internal catalog. It also knows about the lo

WordPress 后台添加额外选项字段到常规设置页面

有时候我们需要添加一些额外的设置选项到常规设置(后台 > 设置 > 常规)页面,下面是一个简单的范例: 直接添加到主题的 functions.php 即可: /*** WordPress 添加额外选项字段到常规设置页面* http://www.wpdaxue.com/add-field-to-general-settings-page.html*/$new_general_setting = new new_general_setting();class new_general_setting

Unity3D实践系列05,为GameObject添加额外属性

在Unity中,通常通过脚本为GameObject添加额外的属性.具体有2种方式:一种是通过硬编码为脚本字段赋值,另一种是通过反射在运行时给脚本字段赋值. 脚本通过字段硬编码为GameObject添加额外的属性 创建一个空的GameObject. 点击"Hierarchy"窗口下的GameObject,看到如下的"Inspector"窗口. 现在我们要为这个GameObject增加一个Count属性,该怎么做呢? 在"Project"窗口下的&q

【15.03.13】手动快速在Linux桌面上添加一个程序图标快捷方式

部分Linux发行版提供了在桌面上添加某个程序图标的快捷操作方法,但有的发行版可能没有提供,或者说刚上手某个发行版,暂时还没找到在哪里操作.这个时候,我们可以手动在Linux桌面上添加一个快捷方式的程序图标. Linux桌面程序图标的文件名是"XXX.desktop",当然,这个文件名并不是我们在桌面上看到的图标的名字.关于desktop文件的详细结构,如果想了解,可以参考这篇技术文献:Linux Desktop Entry 文件深入解析. 但是对于普通用户来说,我们没必要了解那么多的