html - 全 Angular 按钮,Bootstrap3

标签 html css twitter-bootstrap-3

这是我的HTML

<div id="formSuscription">
    <form class="form-inline">
        <div class="form-group">
            <input type="text" class="form-control" placeholder="First Name">
        </div>
        <div class="form-group">
            <input type="text" class="form-control" placeholder="Last Name">
        </div>
        <div class="form-group">
            <input type="email" class="form-control" placeholder="Email">
        </div>
        <div class="form-group ">
            <input type="button" class="form-control" value="Submit">
        </div>
        <div class="clearfix"></div>
        <center>
            <div class="form-group">
                <label>
                    <input type="checkbox" class="form-control" value="Submit"> DON'T SHOW AGAIN
                </label>
            </div>
        </center>
    </form>
</div>

图片:https://www.dropbox.com/s/mpa7rybvpngf19z/ohnails.png 由于我的声誉,我无法发布图片

如何让按钮全宽?

我试过:

style: display: block; width: 100%;

class btn-block

<div class="form-group btn-group-justified">
<input class="form-control btn-block" type="button" style="display: block; width: 100%;" value="Submit">
</div>

但不工作

最佳答案

您可以覆盖当前的 css通过添加 id="submit"<button>标记并使用 css改变它的宽度。

您的示例:http://jsfiddle.net/urahara/b64yf2jm/2/

你可以静态地做:

编辑这个:

<input id="submit" type="button" class="form-control" value="Submit">

使用 CSS:

#submit{
   width:180px; // <-- Your width value
}

或使用 css动态通过 jQuery :

这里我们所做的是分配 #submit按钮 widthwitdh表单上的其他字段。 (我添加了 +8 来补偿填充或边距,稍微调整一下)

jQuery:

$('#submit').css('width', $('.form-control').width()+8);

关于html - 全 Angular 按钮,Bootstrap3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29082076/

相关文章:

html - 在 WebSlides 中嵌入 Bokeh 时工具栏未对齐

jquery - 如何在 jQuery 中实现旋转动画?

javascript - 按钮标签 jQuery DataTable

html - 将文本定位在右下角

javascript - 如何使用包含图像 url 的 JS 数组设置背景 html 主体的图像?

html - 如何创建带有箭头显示到下一个圆圈的圆 div

html - 是否可以在文本区域中设置右下角拖动箭头的样式?

javascript - 使用 jquery 计算包含另一个有边距的元素的高度

html - 为什么我的 div 边距重叠,我该如何解决?

html - Div 在 Chrome 和 Opera 中不可见