Tôi đang cố gắng xác định cách căn giữa (theo chiều dọc và chiều ngang) trong thẻ div.Làm cách nào để các nút giữa (theo chiều dọc và chiều ngang) trong thẻ div?
Với CSS sau:
div.listBoxMoverUserControl
{
width: 350px;
height: 175px;
}
div.listBoxMoverUserControl div
{
height: 150px;
}
div.listBoxMoverUserControl div select
{
width: 150px;
height: 150px;
}
div.listBoxMoverUserControl div.listBoxMoverUserControl_column1
{
float: left;
width: 150px;
}
div.listBoxMoverUserControl div.listBoxMoverUserControl_column2
{
float: left;
width: 50px;
}
div.listBoxMoverUserControl div.listBoxMoverUserControl_column3
{
float: left;
width: 150px;
}
Tôi muốn có các nút trong đánh dấu này làm trung tâm. Làm thế nào tôi có thể sửa đổi CSS để đạt được điều này?
<div class="listBoxMoverUserControl">
<div class="listBoxMoverUserControl_column1">
<label>Test1</label>
<asp:ListBox runat="server"></asp:ListBox>
</div>
<div class="listBoxMoverUserControl_column2">
<input id="btnMoveRight" type="button" value="->" /> <br />
<input id="btnMoveLeft" type="button" value="<-" /> <br />
</div>
<div class="listBoxMoverUserControl_column3">
<label>Test2</label>
<asp:ListBox runat="server"></asp:ListBox>
</div>
</div>
... và nếu chiều rộng của hộp của bạn biến, bạn có thể đặt lề trái: 25% và lề phải: 25%, nó hoạt động tốt. – salgua