Twitter bootstrap 我能';尽管尝试文本对齐、溢出和clearfix,但不要将此输入框居中
我把厨房的水槽扔到这一个,但我不知道怎么把它放在中心 我猜class=“navbar form navbar left”与此有关,但删除它或将其更改为navbar right并没有任何作用 HTML:Twitter bootstrap 我能';尽管尝试文本对齐、溢出和clearfix,但不要将此输入框居中,twitter-bootstrap,Twitter Bootstrap,我把厨房的水槽扔到这一个,但我不知道怎么把它放在中心 我猜class=“navbar form navbar left”与此有关,但删除它或将其更改为navbar right并没有任何作用 HTML: 如果要在元素上设置宽度,只需使用边距:0 auto将其居中即可 text align:center不起作用的原因是纯block级别元素(在本例中为div)不尊重该属性 对于另一种方法,可以使元素内联块并将文本对齐:居中添加到父元素。Bootstrap为此有一个类,只需将text center添加
如果要在元素上设置宽度,只需使用
边距:0 auto
将其居中即可
text align:center
不起作用的原因是纯block
级别元素(在本例中为div
)不尊重该属性
对于另一种方法,可以使元素内联块
并将文本对齐:居中
添加到父元素。Bootstrap为此有一个类,只需将text center
添加到元素的类列表中即可
相关:谢谢。如果我没有指定宽度,我将如何将其居中?
<div class="clearfix" id="problemcontainer">
<form class="myform" method="GET" action="servlet" class="navbar-form navbar-left">
<div class="clearfix">
<div id="dateFieldandCalendar">
<div class="input-group date">
<input id="datepicker" name="pickedDate" type="text" class="form-control" placeholder="mm/dd/yyyy"/>
<span class="input-group-btn">
<button class="btn btn-default" type="button" id="datebtn">
<i class="glyphicon glyphicon-calendar"></i>
</button>
</span>
</div>
</div>
</div>
<button type="submit" class="btn btn-success"><i class="glyphicon glyphicon-ok"></i> Calculate Dates!</button>
<button type="reset" class="btn btn-warning"><i class="glyphicon glyphicon-remove"></i> Reset</button>
<input id="month" name="monthHTML" value="" type="hidden"/>
<input id="day" name="dayHTML" value="" type="hidden"/>
<input id="year" name="yearHTML" value="" type="hidden"/>
<input id="formID" name="formIDHTML" value="CaStateMSJID" type="hidden"/>
</form>
</div>
.problemcontainer {
text-align: center;
overflow: collapse;
}
.myform {
margin-top: 10px;
text-align: center;
overflow: collapse;
}
.input-group.date {
text-align: center;
width: 150px;
overflow: collapse;
}
.dateFieldandCalendar {
overflow: collapse;
text-align: center;
}
.input-group-btn {
text-align: center;
}
.form-control {
text-align: center;
}
.input-group {
text-align: center;
}
.datepicker {
text-align: center;
}
.input-group.date {
margin:0 auto;
width: 150px;
}