【发布时间】:2017-09-28 13:24:08
【问题描述】:
我在 Bootstrap 中将表单居中时遇到问题。我似乎也无法调整输入框的大小。我想让它居中。
这就是我所拥有的:
<div class="form-group row" id="SignupCreate">
<div class="col-sm-4">
<label>Email</label>
<input type="email" class="form-control" id="inputEmail" placeholder="Email">
</div>
<div class="col-sm-4">
<label>Password</label>
<input type="password" class="form-control" id="inputPassword" placeholder="Password">
<div class="col-sm-4">
<button type="submit">Submit</button>
</div>
</div>
</div>
对于 CSS,我开始了:
#SignUpCreate {
padding-top: 200px;
margin-right: 30px;
margin-left: 30px;
}
【问题讨论】:
-
我假设“居中”是指每边的边距相等?此外,如果你更好地格式化它,你会发现你已经错误地嵌套了一些列。
-
您在 html 中使用
id="SignupCreate",在 CSS 中使用#SignUpCreate。案例需要匹配。
标签: html css twitter-bootstrap