Support » Fixing WordPress » aligncenter in images creates spacing

  • Resolved derekbeck


    why is that if I allow the class=”aligncenter” to persist when I use the media button to put an image into a post, for example:

    <div align="center">
    <a href="">
    <img src=""
    style="clear: right;" alt=""
    title="Sketch of the Burning & Destroying of Castle William in Boston Harbour (Archibald Robertson)"
    width="640" height="421"
    class="aligncenter size-full wp-image-619" /></a>
    My self-placed caption

    Then “My self-placed caption” gets a large space between it and the image. But if I simply delete the “aligncenter” from the class of the image link, “My self-placed caption” hugs the bottom of the image, just as it appears presently at my latest post:

    Is there some way to easily alter the css for the aligncenter class?


Viewing 3 replies - 1 through 3 (of 3 total)
  • esmi


    Forum Moderator

    Try looking in your theme’s stylesheet.

    thx, will check that out!

    i ended up solving by creating this solution:

    replace in the above example the line “My self-placed caption” with:

    <div class=”imgcaption”>My self-placed caption</div>

    and in my CSS I definited:

    .imgcaption {
    position: relative;
    top: -10px;
    font-size: 0.80em !important;
    padding: 0px;
    margin: 0px;
    text-align: left;
    float: none;
    .imgcaptioncenter {
    text-align: center;
    .imgcaptionright {
    text-align: right;

    If I want it aligned center instead of left, I use:

    <div class=”imgcaption imagecaptioncenter”>My self-placed caption</div>


Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘aligncenter in images creates spacing’ is closed to new replies.