Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 如何在引导中将窗体居中放置在居中的div中?_Css_Twitter Bootstrap - Fatal编程技术网

Css 如何在引导中将窗体居中放置在居中的div中?

Css 如何在引导中将窗体居中放置在居中的div中?,css,twitter-bootstrap,Css,Twitter 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; j

我不知道为什么边距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;
}

用上述代码替换您的代码并查看结果。

尝试其他浏览器。在ffox上看起来不错。我得到了div和formcenter。