0

I really don't understand why this thumbnail can't be in the center ? I've tried with margin: 0 auto, trying to use col-md-... but nothing works.

Can someone help ?

Thank you

<div id="primary" class="content-area">
    <main id="main" class="site-main container" role="main">
        <div class="row">
            <div class="col-md-6 col-centered">
        <?php the_post_thumbnail('thumbnail'); ?>
    </div>
    </div>
    <div class="row">
        <div class="col-md-10 col-xs-12 col-centered">
    <?php
    while ( have_posts() ) : the_post();

        get_template_part( 'template-parts/content', get_post_format() );

    endwhile; // End of the loop.
    ?>
</div>

My CSS

.col-centered {
    float: none;
    margin: 0 auto;
}

img {
  margin: 0 auto;
}
1
  • 1
    This isn't a WordPress question, it's a Bootstrap/CSS question
    – Tom J Nowell
    Commented Apr 24, 2017 at 0:43

1 Answer 1

0

The image is probably not display:block (they are inline by default), and so using margin: 0 auto won't do anything.

Try either adding text-align:center to your .col-centered, or setting your image tag to display:block (with margin: 0 auto).

Best I can do without seeing more of the surrounding styles.

1
  • text-align on the image worked. Thanks !
    – ferdi_
    Commented Apr 24, 2017 at 0:49

Not the answer you're looking for? Browse other questions tagged or ask your own question.