Support » Themes and Templates » Editing an image caption

  • I’m trying to figure out how to edit the caption for an image.

    I have the following in style.css

    .wp-caption-text {
        background: #595d80;
        color: #fff;
        font-weight: italic;
        font-size: 8px;
    }

    This works up to a point. It changes the background/text colour and makes it italic, but it doesn’t change the font size.

    Also, how do I bring the caption to appear directly below the image and be the same width?

    You can see this at:
    http://inhampshire.net/uncategorized/201

    There are two image captions, one at the top and another a little further down.

    Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Chip Bennett

    (@chipbennett)

    Theme Review Admin

    You’re using the right CSS class (.wp-caption-text), but you might not have enough specificity.

    What do you mean by specificity?

    I’m learning this as I go along, so some things have passed me by.

    It’s just weirtd that everything else I put in the element is working.

    Chip Bennett

    (@chipbennett)

    Theme Review Admin

    I would start with a good CSS tutorial.

    The other attributes are no doubt applying just fine, but your font-size attribute is probably defined somewhere with an ID selector that has higher specificity than, and is therefore overriding, your .wp-caption-text class attribute definition.

    If you use Firefox, try using firebug (or my preference: Developer Tools, in Chrome), which can help you determine what style definitions are being applied to any given element.

    It looks like I also need to use:

    .wp-caption- {
    }

    It hasn’t solved the font problem yet, but it looks like the area I shouldbe looking at – maybe 🙂

    Thanks

    Chip Bennett

    (@chipbennett)

    Theme Review Admin

    The .wp-caption class (note: remove the trailing hyphen) applies to the container that holds the image and the caption.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Editing an image caption’ is closed to new replies.