图像在 Wordpress 中居中对齐
Image alignment centered in Wordpress
我在 Wordpress 的几个主题安装中看到了这一点,它们没有 CSS 用于图像的对齐中心。我正在尝试添加它,以便此页面顶部的图像居中,但它不起作用:
HTML
<a href="http://www.estiponagroup.com/dev/wp-content/uploads/Header.jpg" class="fluidbox fluidbox-closed" id="fluidbox-1">
<div class="fluidbox-wrap" style="z-index: 990;">
<img width="540" height="160" alt="Header" src="http://www.estiponagroup.com/dev/wp-content/uploads/Header.jpg" class="wp-image-1114 size-full aligncenter" style="opacity: 1;">
<div class="fluidbox-ghost" style="width: 540px; height: 160px; top: 0px; left: 0px;"></div>
<div class="fluidbox-loader" style="width: 540px; height: 160px; top: 0px; left: 0px;"></div>
</div>
</a>
CSS:
img.aligncenter {margin:0 auto !important;}
我错过了什么?
默认情况下图片是内联的,因此不能用边距定位。
img.aligncenter {
margin:0 auto !important;
display: block;
}
此外,width
和 height
属性已弃用(并且在 IE10+ 中不起作用)。请改用 style
。
我在 Wordpress 的几个主题安装中看到了这一点,它们没有 CSS 用于图像的对齐中心。我正在尝试添加它,以便此页面顶部的图像居中,但它不起作用:
HTML
<a href="http://www.estiponagroup.com/dev/wp-content/uploads/Header.jpg" class="fluidbox fluidbox-closed" id="fluidbox-1">
<div class="fluidbox-wrap" style="z-index: 990;">
<img width="540" height="160" alt="Header" src="http://www.estiponagroup.com/dev/wp-content/uploads/Header.jpg" class="wp-image-1114 size-full aligncenter" style="opacity: 1;">
<div class="fluidbox-ghost" style="width: 540px; height: 160px; top: 0px; left: 0px;"></div>
<div class="fluidbox-loader" style="width: 540px; height: 160px; top: 0px; left: 0px;"></div>
</div>
</a>
CSS:
img.aligncenter {margin:0 auto !important;}
我错过了什么?
默认情况下图片是内联的,因此不能用边距定位。
img.aligncenter {
margin:0 auto !important;
display: block;
}
此外,width
和 height
属性已弃用(并且在 IE10+ 中不起作用)。请改用 style
。