Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/84.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/34.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
Html 对中<;部门>;使用CSS_Html_Css_Center - Fatal编程技术网

Html 对中<;部门>;使用CSS

Html 对中<;部门>;使用CSS,html,css,center,Html,Css,Center,我建立了以下网站: 我试图将“黄金计划”白色CSS框居中,以便它整齐地放在“我们的包”标题下 需要编辑白框的CSS代码为: .investment_plans{ height: 100%; background-position: center 0; background-size: cover; position: relative; padding-top: 100px; padding-bottom:120px; } 我已经玩了好几个小

我建立了以下网站:

我试图将“黄金计划”白色CSS框居中,以便它整齐地放在“我们的包”标题下

需要编辑白框的CSS代码为:

.investment_plans{

    height: 100%;
    background-position: center 0;
    background-size: cover;
    position: relative;
    padding-top: 100px;
    padding-bottom:120px;
}
我已经玩了好几个小时了,但是我找不到一个方法来把箱子放在中间

任何帮助都将不胜感激


欢呼。< /P> < P>如果你想用CSS居中一个div,你可以试试下面的代码,它在屏幕中部

.investment_plans{
  height: 100%;
  background-position: center 0;
  background-size: cover;
  position: relative;
  padding-top: 100px;
  padding-bottom:120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-height: 100vh;
}

请在此处添加有意义的代码和问题描述。不要只是链接到需要修复的站点——否则,一旦问题解决或者你链接到的站点无法访问,这个问题将对未来的访问者失去任何价值。发布一个能证明你的问题的帖子会帮助你得到更好的答案。有关更多信息,请参阅“谢谢!”!在这种情况下,将
边距:0 auto
添加到白色块div中,它将居中;右边距:自动,不应该有
位置
,也不应该有使元素使用100%宽度的子元素-对于初学者。