[Resolved] Image Caption Centered

Home Forums Support [Resolved] Image Caption Centered

Home Forums Support Image Caption Centered

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #108896
    Jack Heape

    What code should I use to center the caption on an image? I tried this…

    .wp-caption .wp-caption-text {
    padding: 8px 10px;
    margin: 0;
    text-align: center;
    background: url(‘images/blk_trans.png’);
    color:#FFF;
    position:absolute;
    bottom: 0;
    left: 0;
    }

    but it didn’t work. I read the post on the caption below an image, but all I want is for the text in the caption to be centered in the image, not aligned left.

    #108912
    Tom
    Lead Developer
    Lead Developer

    Give this CSS a try:

    .wp-caption .wp-caption-text {
          width: 100%;
          text-align: center;
          -moz-box-sizing: border-box;
          -webkit-box-sizing: border-box;
          box-sizing: border-box;
    }
    #108916
    Jack Heape

    Worked great! Thanks. The caption is outside the image now but that is fine.

    #108970
    Tom
    Lead Developer
    Lead Developer

    Hmm it shouldn’t be – can you link me to a page with it so I can see?

    #108993
    Jack Heape
    #109010
    Tom
    Lead Developer
    Lead Developer

    Did you perhaps replace the core styling (in your first post) with what I added above?

    All core CSS should be left alone – making changes to that stylesheet will result in you losing all of your modifications when you update WordPress.

    All custom CSS should go in a child theme or a custom CSS plugin: http://generatepress.com/knowledgebase/adding-css/

    Let me know ๐Ÿ™‚

    #109123
    Jack Heape

    Voila’!
    I used simple css and made all your suggested changes. Everything seems to be working fine now.
    Thanks!

    #109140
    Tom
    Lead Developer
    Lead Developer

    You’re welcome! ๐Ÿ™‚

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.