I am trying to center a block element (WordPress title field, including image), but it will not work. I tried:
.imagecenter { margin-left: auto; margin-right: auto; display: block; }
But that just won't work. I also tried margin-left: auto; margin-right: auto; margin-left: auto; margin-right: auto; but that won't work either. Is there something I'm doing wrong? This is what the W3C documentation says I should do.
It looks like this in HTML (specify):
<div id="content"> ........post here...... <div class="wpcaption imagecenter" style="width:225px"> <img src="blah" /> Blah. </div> .........post here...... </div>
I have no control over the width of the element. It is set by the user. The user wants the div to be centered. This does not work. I looked at the documentation, but it still won't work.
EDIT: ALREADY SHOULD LOSE MARGIN-LEFT: AUTO AND MARGIN-RIGHT: AUTO. THIS DOES NOT WORK.
html css wordpress
Brandon wang
source share