简体   繁体   中英

Make image center aligned

I want to make the images on this page centre aligned. I have tried below solution but it does not work in my case. Please guide. PASSWORD: inspurate123

Solution:

display: block;
margin-left: auto;
margin-right: auto; 

My code:

<div class="title_area" style="float:left;">
    <h1 class="post_title">
        <a href="<?php the_permalink();?>" title="<?php the_title_attribute(); ?>">
            <?php the_title(); ?>
        </a>
    </h1>
    <br>

    <?php the_content(); ?>                     
</div>   
</article>
<?php get_template_part('share_this');?>
</div>

在此处输入图片说明

Try it:-

.wp-caption.alignnone{
     margin:0 auto
 }
.title_area img {
    display: block;
    margin: 0 auto;
    width: 90%;
}

Hope it works for you.

在此处输入图片说明

First of all remove float

you can do it like below

Fiddle

http://jsfiddle.net/q2bm79t2/

img{
    margin:0 auto;

    }

.imageReplace{
    text-align:center

}

Html

<div class="imageReplace">
    <img src="http://drublic.de/blog/wp-content/uploads/2011/10/rotate-images.jpg">
</div>

Try this

.parent {
  position: relative;
}
.child {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

You can use display:inline-flex (CSS3)

add this to the body{display:inline-flex; width:100%;} body{display:inline-flex; width:100%;}

now remove the padding from your login.

It's css3, some browsers won't support it.

Try this and let me know if it worked

img{
display:block !important;
clear:both;
margin:0 auto;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM