WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] aligncenter in images creates spacing (4 posts)

  1. derekbeck
    Member
    Posted 3 years ago #

    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="http://www.derekbeck.com/1775/wp-content/uploads/2011/03/Archibald-Robertson-Plate-25.png">
    <img src="http://www.derekbeck.com/1775/wp-content/uploads/2011/03/Archibald-Robertson-Plate-25-1024x674.png"
    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
    </div>

    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: http://www.derekbeck.com/1775/info/evacuation-of-boston/
    ?

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

    Thanks,
    Derek

  2. esmi
    Theme Diva & Forum Moderator
    Posted 3 years ago #

    Try looking in your theme's stylesheet.

  3. derekbeck
    Member
    Posted 3 years ago #

    thx, will check that out!

  4. derekbeck
    Member
    Posted 3 years ago #

    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>

    Derek
    http://www.1775thebook.com

Topic Closed

This topic has been closed to new replies.

About this Topic