WordPress.org

Ready to get started?Download WordPress

Forums

Editing an image caption (6 posts)

  1. HorrorUK
    Member
    Posted 3 years ago #

    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.

  2. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

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

  3. HorrorUK
    Member
    Posted 3 years ago #

    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.

  4. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    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.

  5. HorrorUK
    Member
    Posted 3 years ago #

    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

  6. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.