Twitter bootstrap 使用Twitter引导对齐按钮

Twitter bootstrap 使用Twitter引导对齐按钮,twitter-bootstrap,Twitter Bootstrap,我正在尝试让对齐在引导中正常工作。我一直在看,我也尝试过,但我就是不能得到我所想的效果 这是我正在使用的代码: <h1>{% trans %} x {% endtrans %} <small>{% trans %} yw {% endtrans %}</small></h1> <input class="form-control" type="text"> <button type="button" class="btn btn

我正在尝试让对齐在引导中正常工作。我一直在看,我也尝试过,但我就是不能得到我所想的效果

这是我正在使用的代码:

<h1>{% trans %} x {% endtrans %} <small>{% trans %} yw {% endtrans %}</small></h1>

<input class="form-control" type="text">
<button type="button" class="btn btn-primary custom-button-width">{{ icon('plus') }} {% trans %} z1 {% endtrans %}</button>
<button type="button" class="btn btn-warning custom-button-width .navbar-right">{{ icon('edit') }} {% trans %} z2 {% endtrans %}</button>
<button type="button" class="btn btn-danger custom-button-width .navbar-right">{{ icon('remove') }} {% trans %} z3 {% endtrans %}</button>

<br />
<br />

<table class="table table-hover">
...
{%trans%}x{%endtrans%}{%trans%}yw{%endtrans%}
{{icon('plus')}{%trans%}z1{%endtrans%}
{{icon('edit')}{%trans%}z2{%endtrans%}
{{icon('remove')}{%trans%}z3{%endtrans%}


...
下面是一个实际情况的示例,以及我试图实现的目标


非常感谢您的任何想法。

由于您使用的是
自定义按钮宽度
类,您也可以使用
.custom input width
类来设置输入宽度。然后创建两列并右对齐右侧按钮

.custom-input-width {
    width:150px;
    margin-right:3px;
}

演示:

由于您使用的是
自定义按钮宽度
类,因此也可以使用
自定义输入宽度
类来设置输入宽度。然后创建两列并右对齐右侧按钮

.custom-input-width {
    width:150px;
    margin-right:3px;
}

演示:

Skelly是正确的,但如果可能的话,我更喜欢用twitter内置的引导功能来解决这些问题。“向右拉”帮助器类在这里非常重要:

浮动帮助器类文档:

我经常使用的另一个twbs3功能是网格系统:

网格系统文档:

通过这两种方法,您可以实现以下目标:

<div class="container-fluid">
    <div class="row">
        <div class="col-md-6 col-sm-6">
            <button type="button" class="btn btn-primary">1</button>
            <button type="button" class="btn btn-primary">2</button>
        </div>
        <div class="col-md-6 col-sm-6 clearfix">
            <div class="pull-right">
                <button type="button" class="btn btn-primary">3</button>
                <button type="button" class="btn btn-primary">4</button>
            </div>
        </div>
    </div>
</div>

1.
2.
3.
4.

这里是jsfiddle:

Skelly是正确的,但是如果可能的话,我更喜欢用twitter的内置引导功能来解决这些问题。“向右拉”帮助器类在这里非常重要:

浮动帮助器类文档:

我经常使用的另一个twbs3功能是网格系统:

网格系统文档:

通过这两种方法,您可以实现以下目标:

<div class="container-fluid">
    <div class="row">
        <div class="col-md-6 col-sm-6">
            <button type="button" class="btn btn-primary">1</button>
            <button type="button" class="btn btn-primary">2</button>
        </div>
        <div class="col-md-6 col-sm-6 clearfix">
            <div class="pull-right">
                <button type="button" class="btn btn-primary">3</button>
                <button type="button" class="btn btn-primary">4</button>
            </div>
        </div>
    </div>
</div>

1.
2.
3.
4.

下面是JSFIDLE:

是最佳答案,不需要额外的类。最佳答案是,不需要额外的类