默认情况下button的长度是自动的,如果你想设置跟父容器等宽的话,可以加一个btn-block

与父容器等宽
  To use the full width of the container within which the button is residing, Bootstrap 3 offers block button option.
  使用按钮的block样式,让其与父容器等宽
  1160x178
<div class="container"> 
    <div class="row">
        <div class="col-lg-12"> 
            <p> 
                <button type="button" class="btn btn-primary btn-sm btn-block">Default small block level button</button> 
                <button type="button" class="btn btn-default btn-lg btn-block">Default lg block level button</button> 
                <button type="button" class="btn btn-primary btn-lg btn-block">Default lg block level button</button> 
                <button type="button" class="btn btn-primary btn-xs btn-block">Default extra block level button</button> 
            </p> 
        </div>
    </div>
</div>


效果图


Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐