css - 在 Bootstrap 中居中表单?

标签 css twitter-bootstrap twitter-bootstrap-3

我正在使用 bootstrap 3。

将表单水平居中的最佳方式是什么?

<div class="container">
  <div class="row">
    <form class="form-horizontal" role="form">
        //form stuff here
    </form>
  </div>
</div>

最佳答案

如果你喜欢你可以给你的表单添加一些样式,

form {
    margin-left:auto;
    margin-right:auto;
    width:200px;
}

Demo

关于css - 在 Bootstrap 中居中表单?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19135822/

相关文章:

javascript - 使用 javascript 显示选定复选框的列表

html - Bootstrap 轮播指示器是方形的;我要他们圆

html - 隐藏的输入弄乱了我的填充

javascript - IE 不允许动态创建的 DOM 'a' 元素上的 onClick 事件

twitter-bootstrap - 使用 bootstrap 的弹出窗口保持焦点

html - Bootstrap 3 的事件按钮

html - 使用 HTML5/CSS3 刷新页面将其定向到特定的 div?

javascript - Animate.css 与 Bootstrap 模态的交互,关闭动画的问题

css - Angular 水平形式的日期选择器字段未对齐

html - 如何删除 Bootstrap 3 链接之间的间距?