我试图将所有控件放在同一行上而不使用类行,因为该控件位于一列附近,而该列也具有其他控件。所以我的结构实际上是这样的:

<div class="col-xs-12 col-md-4">
        <button class="btn btn-default">
            <span class="glyphicon glyphicon-plus"></span>
            Add</button>

        <button class="btn btn-default" >
            <span class="glyphicon glyphicon-plus"></span>
            Remove</button>

        <button class="btn btn-default">
            <span class="glyphicon glyphicon-repeat"></span>
            Refresh</button>

        <button class="btn btn-default">
            <span class="glyphicon glyphicon-fullscreen"></span>
        </button>

        <div class="input-group">
            <input type="text"
                   class="form-control"
                   placeholder="Hello world">
            <span class="input-group-btn">
                <button class="clear btn btn-default clean-resource btn-danger" type="button">
                    <span class="glyphicon glyphicon-remove"></span>
                </button>
            </span>
        </div>
  </div>


这是jsfiddle

您如何看到按钮在同一行上,但文本框继续显示,我不知道wham是错的。有人可以帮忙吗?谢谢。

最佳答案

使用这种类型的网格部分和http://www.w3schools.com/bootstrap/bootstrap_grid_system.asp并根据此链接调整屏幕尺寸

 <div class="row">
     <div class="col-sm-4">
            <button class="btn btn-default">
                <span class="glyphicon glyphicon-plus"></span>
                Add</button>

            <button class="btn btn-default" >
                <span class="glyphicon glyphicon-plus"></span>
                Remove</button>

            <button class="btn btn-default">
                <span class="glyphicon glyphicon-repeat"></span>
                Refresh</button>

            <button class="btn btn-default">
                <span class="glyphicon glyphicon-fullscreen"></span>
            </button>
            </div>
            <div class="col-sm-4">
            <div class="input-group">
                <input type="text"
                       class="form-control"
                       placeholder="Hello world">
                <span class="input-group-btn">
                    <button class="clear btn btn-default clean-resource btn-danger" type="button">
                        <span class="glyphicon glyphicon-remove"></span>
                    </button>
                </span>
            </div>
        </div>
        </div>

09-27 07:56