bootstrap 3 input-group 100%width [英] bootstrap 3 input-group 100% width

查看:775
本文介绍了bootstrap 3 input-group 100%width的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在引导文档中,它们具有跨100%宽度的输入组,没有其他标记: http://getbootstrap.com / components /#input-groups

In the bootstrap documentation, they have input groups that span 100% width with no additional markup: http://getbootstrap.com/components/#input-groups

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

我不能看到我的输入组超过100% code> width:100% on input-group 请注意,我稍微调整了标记: p>

I can't seem to get my input groups to span 100% without explicitly defining width: 100% on input-group. Note that I've slightly adjusted the markup:

<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; }

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

I've created a fiddle to represent this problem: http://jsfiddle.net/Wexcode/B9LMN/

推荐答案

向输入元素的兄弟姐妹添加 width:1%可修复此问题:

Adding width: 1% to the input element's sibling fixes this:

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

请参阅 http://jsfiddle.net/Wexcode/B9LMN/2/

这篇关于bootstrap 3 input-group 100%width的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆