html - bootstrap 3 输入组 100% 宽度

标签 html css twitter-bootstrap-3

在 bootstrap 文档中,他们有跨越 100% 宽度且没有额外标记的输入组:http://getbootstrap.com/components/#input-groups

<div class="input-group">
  <input type="text" class="form-control">
  <span class="input-group-addon">.00</span>
</div>

如果不在 input-group 上明确定义 width: 100%,我似乎无法让我的输入组跨越 100%。请注意,我稍微调整了标记:

<div class="input-group">
    <input class="form-control" placeholder="Auto width" />
    <div class="clear">
        <a href="#" class="glyphicon glyphicon-remove"></a>
    </div>
</div>

CSS:

.clear { display: table-cell; }

我创建了一个 fiddle 来表示这个问题:http://jsfiddle.net/Wexcode/B9LMN/

最佳答案

width: 1% 添加到 input 元素的兄弟元素可以解决这个问题:

.clear { width: 1%; display: table-cell; }

参见 http://jsfiddle.net/Wexcode/B9LMN/2/

关于html - bootstrap 3 输入组 100% 宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23436430/

相关文章:

jquery .css ('text-decoration' ) 不适用于 parent

html - 带有换行文本的内联元素,虽然没有 float 但垂直对齐

javascript - 使用 Bootstrap 删除所有屏幕尺寸大于 480 像素的 div

html - 如何将图片(jpg/png/等)嵌入到 html 中并通过邮件发送出去

javascript - 如果只有一行文本,则垂直居中文本区域文本

javascript - 带有两个提交按钮执行两项不同操作的表单

javascript - React-router-modal 奇怪的行为 - 我需要点击两次才能返回,应该只有一次

html - 嵌套在另一行中时如何摆脱 col-md-* 填充,而不影响整个网格?

Javascript html表格隐藏列

html - 表格边框底部的间距