5

嗨 StackOverflow 社区,我正在某些页面中基于 twitter bootstrap 2.0.4 构建一个站点,我想在输入中附加一个按钮。问题是显示在输入和按钮之间有一个边距。

我确定这是我缺少的东西,但我无法确定它是什么?

编辑:某些样式(例如禁用和不可编辑输入)在页面中未正确应用

编辑2:显然工作.disabled和.uneditable-input。

JFiddle:http: //jsfiddle.net/sHGtb/

JFiddle 全屏结果:http: //jsfiddle.net/sHGtb/embedded/result/

有什么帮助吗??

HTML

<!DOCTYPE html>
<html>
<head>
    <title>Page Title</title>
    <meta charset="utf-8">
    <link rel="stylesheet" type="text/css" href="http://localhost/test/index.php/../css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="http://localhost/test/index.php/../css/bootstrap-responsive.min.css">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!--[if lt IE 9]>
        <script src="../../js/html5shiv.js"></script>
    <![endif]-->
    <script type="text/javascript" src="http://localhost/test/index.php/../js/modernizr.js"></script>
</head>
<body>
    <div class="container">
        <form class="form-horizontal">
            <fieldset>
                <hr/>
                <h4>Puesto</h4>
                <p>Debe estar asignado segun su perfil, solo los administradores pueden cambiar esta opcion; si existiese alguna irregularidad debe solicitar reportelo al administardor.</p>
                <div class="control-group">
                    <label for="puesto" class="control-label">Puesto</label>
                    <div class="controls">
                        <div class="input-append">
                            <input type="text" name="puesto" class="input-xlarge" />
                            <button class="btn" type="button"><i class="icon-search"></i></button>
                        </div>
                    </div>
                </div>
                <hr/>

            </fieldset>
        </form>
    </div>  
    <script language="javascript" type="text/javascript" src="http://localhost/test/index.php/../js/jquery-1.7.2.min.js"></script>
    <script language="javascript" type="text/javascript" src="http://localhost/test/index.php/../js/bootstrap.min.js"></script>
</body>
</html>

问题截图

4

2 回答 2

18

这可能听起来很愚蠢,但不要在输入和您的文本编辑器弄乱页面的按钮之间留下新的一行:-P

      <div class="control-group">
                <label for="puesto" class="control-label">Puesto</label>
                <div class="controls">
                    <div class="input-append">
                        <input type="text" name="puesto" class="input-xlarge" /><button class="btn" type="button"><i class="icon-search"></i></button>
                    </div>
                </div>
            </div> 
于 2012-07-10T16:05:04.790 回答
0

如果我理解你,你想消除按钮和输入字段之间的边距吗?你可以试试这样的...

<input type="text" name="puesto" class="input-xlarge" style="margin-right:0;"/>
<button class="btn" type="button" style="margin-left:0;"><i class="icon-search"></i></button>

如果该样式不起作用,请尝试在元素上添加更多 CSS 样式。

于 2012-07-06T18:34:51.077 回答