How to align thumbnail in center

hi friends

kindly open this

you can see image featured aligned in left!

i want to add it on center of layout!
waiting for your kind help

One option - if you are okay using inline styling - is to make the anchor element around the image have a display: block, margin: 0 auto and then place the width of the contained element in the anchors inline style, since you can’t place that in your external stylesheet.

this is a code, can you edit, how it can be done

<div id=“featured”>

    &lt;!-- If home page, show featured image, if not... don't show anything --&gt;
    &lt;?php if(! $paged || $paged &lt; 2) :  ?&gt;
        &lt;?php if (have_posts()) :  ?&gt;
            &lt;?php query_posts('showposts=1'); while (have_posts()) : the_post(); ?&gt;
                &lt;a href="&lt;?php the_permalink() ?&gt;" title="&lt;?php echo get_the_excerpt(); ?&gt;"&gt;&lt;?php the_post_thumbnail('featured-image');  ?&gt;&lt;/a&gt;

<?php echo “<br />”; ?>
<h3><a href=“<?php the_permalink() ?>”><?php the_title(); ?></a></h3>
<div class=“featured-cat”><?php the_category(', ') ?></div>
<div class=“featured-info”>
<?php $myExcerpt = get_the_excerpt(); $tags = array(“<p>”, “</p>”); $myExcerpt = str_replace($tags, “”, $myExcerpt); echo $myExcerpt; ?>
<a href=“<?php the_permalink() ?>”>Continue Reading</a>
</div><!-- /.featured-info –>
<?php endwhile;?>
<?php wp_reset_query(); ?>
<?php endif; ?>
<?php endif; ?>

&lt;/div&gt;&lt;!-- /#featured --&gt;

I’ve actually found a better solution that works entirely inside your external CSS files.

Find the CSS stylesheet /wp-content/themes/deliciouslysimple/style-light.css, and locate this line:

 #featured img {max-width: 640px; margin: 3px 0 10px 0; height: auto;} 

And alter it to this:

 #featured img {max-width: 640px; margin: 3px 0 10px 0; height: auto; display: block; margin: 0 auto} 

I hope this helps!

thanks zarin
works fine

Glad to help, though it now occurs to me that there are who margin rules in there. It’s not essential to remove the first one, but I’d do it all the same.

I hope the rest of the project goes well for you!