• We just changed our theme over to WP 2.7 and previously we’ve had no issues with image alignment. Now that we’ve migrated we’ve found that some of our images are not aligned properly (look left aligned). It seems to be more of an issue in Firefox and Chrome than IE.

    Below I’ve included working and non-working code.

    code not working (image displays as left aligned)

    <div style="text-align: center;"><a href="https://www.x.com"><img class="aligncenter" title="blah" src="/news-images/x.jpg" alt="" width="450" height="350" /></a></div>

    code working (image displays as center aligned)

    <div style="text-align: center;"><a href="https://www.x.com"><img class="alignnone" title="blah" src="/news-images/x.jpg" alt="" width="450" height="338" /></a></div>

    img class=”aligncenter” and class=”alignnone” seem to be the issue. I’ve updated my CSS file with the newest alignment code as follows:

    .aligncenter, div.aligncenter, img.centered, img.aligncenter {display: block; margin-left: auto; margin-right: auto; text-align: center;}
    .alignleft{float:left}
    .alignright{float:right}
    .floatLeft{float:left}
    .floatRight{float:right}
    .clear{clear:both}

    Thanks for any help. This is a site wide issue so it affects thousands of pages created with this type of method.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The parent div has text-align: center; already on it, so should centre the image.

    Try canceling out your styles for the aligncenter class and see what happens.

    Thread Starter djcoldwater

    (@djcoldwater)

    I tried removing just the “.aligncenter” piece of the CSS and then the whole “.aligncenter, div.aligncenter, img.centered, img.aligncenter {display: block; margin-left: auto; margin-right: auto;}” line and neither fixed the issue.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Issue with image aligncenter in 2.7’ is closed to new replies.