css - Bootstrap 在标签而不是表单字段中有反馈图标

标签 css twitter-bootstrap

当结合使用 Bootstrap has-feedback 图标和标签时,图标显示在与标签相同的水平线上,而不是在表单字段中。

当我删除 <label for="bedr_naam">Bedrijfsnaam</label> 时它设置正确。

有什么建议吗?

<div class="container">
    <div class="col-md-5">
        <div class="form-group has-warning" id="div_bedrijfsnaam">
          <label for="bedr_naam">Bedrijfsnaam</label>
          <input type="text" class="form-control" id="bedrijfsnaam" name="bedrijfsnaam" value="'.$row['bedrijfsnaam'].'" onkeyup="validate()" onclick="validate()"><span class="glyphicon glyphicon-warning-sign form-control-feedback" id="bedrijfsnaam_status">
        </div>
    </div>

最佳答案

这是来自 documentation 的示例:

<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#div_bedrijfsnaam没有has-feedback类,label没有control-label

关于css - Bootstrap 在标签而不是表单字段中有反馈图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44618816/

相关文章:

javascript - jQuery 的 FadeTo() 不适用于导航栏

javascript - 基于某些变量的 Bootstrap 上下文表

css - 流体布局中的高度

javascript - 在 Angular SPA 中将 Controller 添加到 index.html

javascript - 从 div 标签内的样式调用 javascript 函数

css - 自动高度不起作用,只有最小高度有效

css 转换不工作

ruby-on-rails - 将 Ruby 字符串插值作为 ID

css - 居中对齐分页栏

css - 使用 CSS 和 Bootstrap 3 突出显示当前悬停在 html 表中的行和列