如何在twitter bootstrap中心形式? [英] How to center form in twitter bootstrap?
本文介绍了如何在twitter bootstrap中心形式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<div class="container">
<div class="row">
<div class="span6 center">
<form>
<table>
<tbody>
<td>foo</td>
</tbody>
</table>
</form>
</div>
</div>
</div>
注意:我使用的是抽象图层,因此无法更改< form>
。
Note: I am using an abstracted layer so am unable to change the class of <form>
.
如何使用Twitter-Bootstrap获取表单中心?
FYI:我也尝试过以分页为中心
。
FYI: I have also tried with pagination-centred
.
推荐答案
这两个回答都是有效的,工作,所以我upvoted他们。这是我没有看到的另一种方法。
Both answers posted are valid and work so I upvoted them. Here is another method i did not see posted.
您可以将表单设置为 display:inline-block
并使用 text-align:center
将它居中在 .center
这样,无论该容器内的宽度如何,表单都会居中:
You can center your form by setting it to display:inline-block
and center it within the .center
container using text-align:center
. This way the form will center regardless of width within that container:
CSS
.center {
text-align:center;
}
.center form {
display:inline-block;
}
这篇关于如何在twitter bootstrap中心形式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文