Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/81.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集中在包含div的div中?_Css_Html_Center - Fatal编程技术网

Css 如何将一组div集中在包含div的div中?

Css 如何将一组div集中在包含div的div中?,css,html,center,Css,Html,Center,我有一组列需要在一个容器div中居中,背景颜色为#eeeff3,这样当你缩小时,列保持相同的大小和居中,灰色背景保持100%宽度。单击链接查看当前的html和css! 有人能解释一下情况吗 jsfiddle links require code 删除float:left并添加display:inline块 见更新 试试这个css是否能很好地工作: .container{ margin:0 auto; background: #eeeff3; width:100%

我有一组列需要在一个容器div中居中,背景颜色为#eeeff3,这样当你缩小时,列保持相同的大小和居中,灰色背景保持100%宽度。单击链接查看当前的html和css!

有人能解释一下情况吗

jsfiddle links require code

删除
float:left
并添加
display:inline块

见更新


试试这个css是否能很好地工作:

.container{
     margin:0 auto;
     background: #eeeff3;
     width:100%;
     height:400px;
     text-align:center;

}
.col4{
    float:left;
    width:270px;
    height:400px;
    border-right:2px solid white;
    display:inline-block;
}

请张贴您的HTML和当前CSS。+1也请注意。
.container{
     margin:0 auto;
     background: #eeeff3;
     width:100%;
     height:400px;
     text-align:center;

}
.col4{
    float:left;
    width:270px;
    height:400px;
    border-right:2px solid white;
    display:inline-block;
}
.container{
     margin:0 auto;
     background: #eeeff3;
     width:100%;
     height:400px;
     text-align:center;
}
.col4{
    width:270px;
    height:400px;
    border-right:2px solid white;
    display:inline-block;
}