Ready to get started?Download WordPress


image & caption don't display correctly using class (2 posts)

  1. richards1052
    Posted 8 years ago #

    I've inserted this code into a post after installing css as directed in the codex here:

    I also followed the codex instructions in creating this display code:

    <div class="caption left">
    <img src='http://www.richardsilverstein.com/photos/uncategorized/beilin_03.jpg' title="Yossi Beilin" alt=''" />
    <br />
    Yossi Beilin congratulates Abu Mazen on becoming Palestinian president</div>

    Could someone take a look at the post where the image displays:

    There are 2 problems: first the image is layed over a paragraph of text; and second the caption is squeezed war far to the left into 9 lines of text when I'd prefer it to display wider over say 2 or 3 lines of text.

    Is the problem in the display code or my css? I'm hoping it's the display code as that's easier to fix.

  2. richards1052
    Posted 8 years ago #

    I discovered what a big part of the problem is. The codex suggests this code for captions:
    .caption { margin: 5px;
    padding: 5px;
    width: 45px;
    border: solid 0px #E5E5FF;
    background: #E5F2FF;
    color: blue }

    Why does it make the caption width so narrow? That's what's making my caption go scrunched to the left (btw, you won't see it scrunched anymore since I've changed the css width to the same width as the img. 225px). This of course won't work since if a picture is wider or smaller than 225px then I'll get into similar problems.

    Is there any way you can change this css to match the width of the caption to the width of the image? That'd be much better for me.

Topic Closed

This topic has been closed to new replies.

About this Topic