CSS twitter bootstrap 3 input-group-addon 大小不一

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18075467/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 23:49:08  来源:igfitidea点击:

twitter bootstrap 3 input-group-addon not all the same size

csstwitter-bootstrap

提问by J.Pip

Basically I have a couple of input fields which have a span prepended with some text. When I try to set col-lg-4 and col-lg-8 on the input-group-addon and the input field itself, it doesn't do what I expected it to do and resize them.

基本上我有几个输入字段,它们有一个带有一些文本的跨度。当我尝试在 input-group-addon 和输入字段本身上设置 col-lg-4 和 col-lg-8 时,它没有按照我的预期执行并调整它们的大小。

<div class="input-group">
   <span class="input-group-addon">some text</span>
   <input type="text" class="form-control" id="current_pwd" name="current_pwd" />
</div>

Can anyone help me getting the input-group-addon get the same size?

谁能帮我让 input-group-addon 获得相同的大小?

I've created a fiddle here: http://jsfiddle.net/Dzhz4/that explains my problem.

我在这里创建了一个小提琴:http: //jsfiddle.net/Dzhz4/解释了我的问题。

Anyone that can shed some light please?

任何人都可以透露一些信息吗?

回答by Falguni Panchal

try this

尝试这个

http://jsfiddle.net/Dzhz4/1/

http://jsfiddle.net/Dzhz4/1/

.input-group-addon {
    min-width:300px;// if you want width please write here //
    text-align:left;
}

回答by rictionaryFever

.input-group-addon { width: 50px; } // Or whatever width you want

.input-group { width: 100%; }

The first part sets the width of your addons, the second forces the inputs to take up all of their parent container.

第一部分设置插件的宽度,第二部分强制输入占用其所有父容器。