[英]How do I center a form inside a centered div in Bootstrap?
我不知道為什么邊距0自動並為表單設置寬度不會在中間設置表單。
.margin-bottom {
margin-bottom: 15px;
}
#center {
max-width: 400px;
margin: 0 auto;
}
.form-horizontal{
width: 300px;
margin: 0 auto;
}
表單所在的外部div應該居中,然后表單應該在div內部居中。
您可以使用flex
#center {
display:flex;
justify-content: space-around;
}
用上面的代碼替換您的代碼,然后查看結果。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.