[英]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.