Css 如何使用引导将包含图像的不均匀列的行居中?
如何使列数不均匀的一行图像居中,例如,当我使用以下代码时(我需要使图像彼此相邻,这就是为什么我有一个Css 如何使用引导将包含图像的不均匀列的行居中?,css,twitter-bootstrap,Css,Twitter Bootstrap,如何使列数不均匀的一行图像居中,例如,当我使用以下代码时(我需要使图像彼此相邻,这就是为什么我有一个。无填充类): 试试这个: 放置显示:内联块;浮动:无用于每个.row>div,和文本对齐:居中用于.container>.row .row{ 浮动:无; 文本对齐:居中; 宽度:400px; 边框:1px纯红; } .col-md-3{ 宽度:30%; } .行。没有填充{ 显示:内联块; } 1.没有填充物{ 边框:1px纯绿色; 背景色:#ddd; 高度:50px; } 查找 .no
。无填充类):
试试这个:
放置显示:内联块;浮动:无代码>用于每个.row>div
,和文本对齐:居中代码>用于.container>.row
.row{
浮动:无;
文本对齐:居中;
宽度:400px;
边框:1px纯红;
}
.col-md-3{
宽度:30%;
}
.行。没有填充{
显示:内联块;
}
1.没有填充物{
边框:1px纯绿色;
背景色:#ddd;
高度:50px;
}
查找
.no-padding {
padding: 0;
}
.col-md-3{
float:none;
display:inline-block;
margin:0 -2px;
padding:0;
}
.tac{
text-align:center;
}
HTML:
.row-centered {
text-align:center;
}
.col-centered {
display:inline-block;
float:none;
/* reset the text-align */
text-align:left;
/* inline-block space fix */
margin-right:-4px;
}
.no-padding {
padding: 0;
}
.col-md-3{
float:none;
display:inline-block;
margin:0 -2px;
padding:0;
}
.tac{
text-align:center;
}
<div class="container">
<div class="row tac">
<div class="col-md-3 no-padding">
<img class="img-responsive" src="http://lorempixel.com/400/200/" alt="" />
</div>
<div class="col-md-3 no-padding">
<img class="img-responsive" src="http://lorempixel.com/400/200/" alt="" />
</div>
<div class="col-md-3 no-padding">
<img class="img-responsive" src="http://lorempixel.com/400/200/" alt="" />
</div>
</div>
</div>