说明

为水平排列的表单和内联表单设置可选的图标

示例

<!DOCTYPEhtml><htmllang="zh-CN"><head><metacharset="utf-8"><metahttp-equiv="X-UA-Compatible"content="IE=edge"><metaname="viewport"content="width=device-width,initial-scale=1"><!--上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后!--><title>Bootstrap101Template</title><!--Bootstrap--><linkrel="stylesheet"href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css"integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh5u"crossorigin="anonymous"><!--HTML5shimandRespond.jsforIE8supportofHTML5elementsandmediaqueries--><!--WARNING:Respond.jsdoesn'tworkifyouviewthepageviafile://--><!--[ifltIE9]><scriptsrc="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script><scriptsrc="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script><![endif]--></head><body><divclass="container"><formclass="form-horizontal"><divclass="form-grouphas-successhas-feedback"><labelclass="control-labelcol-sm-3"for="inputSuccess3">Inputwithsuccess</label><divclass="col-sm-9"><inputtype="text"class="form-control"id="inputSuccess3"aria-describedby="inputSuccess3Status"><spanclass="glyphiconglyphicon-okform-control-feedback"aria-hidden="true"></span><spanid="inputSuccess3Status"class="sr-only">(success)</span></div></div><divclass="form-grouphas-successhas-feedback"><labelclass="control-labelcol-sm-3"for="inputGroupSuccess2">Inputgroupwithsuccess</label><divclass="col-sm-9"><divclass="input-group"><spanclass="input-group-addon">@</span><inputtype="text"class="form-control"id="inputGroupSuccess2"aria-describedby="inputGroupSuccess2Status"></div><spanclass="glyphiconglyphicon-okform-control-feedback"aria-hidden="true"></span><spanid="inputGroupSuccess2Status"class="sr-only">(success)</span></div></div></form></div><!--jQuery(necessaryforBootstrap'sJavaScriptplugins)--><scriptsrc="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script><!--Includeallcompiledplugins(below),orincludeindividualfilesasneeded--><scriptsrc="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"crossorigin="anonymous"></script></body></html>

输出