Css 如何将一组div集中在包含div的div中?
我有一组列需要在一个容器div中居中,背景颜色为#eeeff3,这样当你缩小时,列保持相同的大小和居中,灰色背景保持100%宽度。单击链接查看当前的html和css! 有人能解释一下情况吗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%
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;
}