[英]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
密码: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
首先去除
float
you can do it like below 你可以像下面这样
Fiddle 小提琴
http://jsfiddle.net/q2bm79t2/ http://jsfiddle.net/q2bm79t2/
img{
margin:0 auto;
}
.imageReplace{
text-align:center
}
Html 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) 您可以使用display:inline-flex(CSS3)
add this to the body{display:inline-flex; width:100%;}
将此添加到
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. 它是css3,某些浏览器不支持它。
Try this and let me know if it worked 试试这个,让我知道它是否有效
img{
display:block !important;
clear:both;
margin:0 auto;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.