WordPress.org

Ready to get started?Download WordPress

Forums

Customizr
Image caption styling (2 posts)

  1. chappie
    Member
    Posted 8 months ago #

    My image captions are all aligned left which suits me fine (I can't remember if that's the default or whether I changed it) but occasionally I use an image which demands a centred caption and so I would like to be able to change the caption styling on a per image basis by adding some code to the Caption field in the Image Edit window.

    Most of the things I have tried have worked briefly but obviously displeased Big Brother because the next time I loaded the page, my caption code had been stripped out. Even inserting a few non-breaking spaces before the caption only worked for a short while.

    I think I was once able to make my styling stick when I wrapped the caption in p tags and centred it - but that gave me some fat padding at the front end so that the caption was too far removed from the image.

    So, is there a correct way to do this which Big Brother likes? I'm thinking I might be able to use CSS to address individual captions by ID but I would prefer just to insert some styling in the Image Editor. (Actually, it's on my wish-list to have Alignment buttons for the caption in addition to Alignment buttons for the image.)

    PS. Some of my captions display wider than the mage they are attached to. I assume that's because there is some default padding assigned to images which isn't equally assigned to the captions. The result is that some of my captions are one character wider than the image which sounds like a small thing but it looks ugly on the page. Can I fix this in CSS? I'm already using the following CSS to move my caption text the desired distance away from the image...

    /* photo caption padding */
    .wp-caption img {margin-bottom: 0.6em;}

    ...but when I try extending the margin to left and right or adding a padding property, the caption text simply changes from being one character too wide on the right to one character too wide on the left!

    Thanks for any guidance.

  2. rdellconsulting
    Member
    Posted 8 months ago #

    Big Brother needs a link to site ;)

Reply

You must log in to post.

About this Theme

About this Topic