Html 使div行的内容在引导中居中
我有一个问题,使我的div行居中,我有3篇文章从wordpress这相当于3列内的行,但它没有居中后,我添加了许多css属性,让它居中。我也在使用wordpress 这是我的密码:Html 使div行的内容在引导中居中,html,css,wordpress,twitter-bootstrap,Html,Css,Wordpress,Twitter Bootstrap,我有一个问题,使我的div行居中,我有3篇文章从wordpress这相当于3列内的行,但它没有居中后,我添加了许多css属性,让它居中。我也在使用wordpress 这是我的密码: <div class="row center-block"> <?php while ( $offerBlog->have_posts() ) : $offerBlog->the_post(); ?> <div class="
<div class="row center-block">
<?php while ( $offerBlog->have_posts() ) : $offerBlog->the_post(); ?>
<div class="col-md-4 ">
<img src="<?php the_field('offer_image') ?>">
<br>
<br>
<h4><?php the_field('offer_title') ?></h4>
<?php the_field('offer_description') ?>
</div>
<?php endwhile; ?>
</div>
试试这个:
检查演示
CSS:
我希望它有帮助关于
文本对齐:居中
在中间块选择器内部如何?显示
没有居中
值。我相信您正在寻找display:block
。有任何答案吗,先生?@JcJohn检查问题,希望它能帮助您。回答得好。。但它与所有浏览器兼容吗?或者仅在最新的浏览器中?Flexbox得到了很好的支持,全球支持率为95.89%。如果你不考虑IE 10及以下版本,微软说你现在可以,这个数字会更高。@Jyoti Pathania回答得很好,女士,非常感谢。
.col-md-4 {
width:15%;
margin:0 2.5%;
text-align: center
}
.center-block {
margin-left:auto;
margin-right:auto;
display:center;
}
.center-block {
display: flex;
flex-direction: row;
justify-content: center;
}