Reputation: 3217
I have seen this in a couple of theme installs in Wordpress where they don't have the CSS for aligncenter for images. I am trying to add it so the image at the top of this page will center but it isn't working:
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;}
What am I missing?
Upvotes: 0
Views: 886
Reputation: 61055
Images are inline by default, and therefore can't be positioned with margin.
img.aligncenter {
margin:0 auto !important;
display: block;
}
Also, the width
and height
attributes are deprecated (and won't work in IE10+). Use style
instead.
Upvotes: 3