Support » Fixing WordPress » How to Vertically Center an Image With Text Below It?

  • Hi all,

    I’m pretty new, here, and DEFINITELY new to coding. I am trying to make the main logo on this placeholder site as WELL as the text below it vertically centered in relation to whatever size the viewer’s web browser is….. I’ve done a million searches and tried every result and still nada =/

    Can ANYONE out there help a poor lost soul out?

    the site in question is

    Thank you all so much for your effort and support!

Viewing 5 replies - 1 through 5 (of 5 total)
  • looks like you’ve achieved what you wanted? If so you should close this post.

    Hi Frankie… There is a simple CSS way to achieve it…

    In the example, i created my own CSS class, you can apply as you wish

    <div class="centerme">

    And the CSS

    .centerme {
        margin:-100px 0 0 -150px;

    As you can see, must declare a Height and Width, then use position absolute with a 50% top and left. It will “almos” center the div, cause it will put the top left corner of div in a 50% of top browser and a 40% of left browser borders.

    So use margin to “compensate”… adding negative half of height as margin top and negative half of width as margin left. It will correct.

    You can see it working in

    There is possible reason it don’t work on your template: If the DIV you’re trying to center is inside another one DIV with position relaitve. A relative DIV alters the behaviour of child DIVs with position absolute…

    By default, absolute is relative to browser viewport, but inside a “position:relative” parent the position is absolute… inside parent, not browser viewport.

    I hope it be usefull to you.

    Hey aritzalvarez,

    Thanks so much for the help. Just to make clear, and because I’m really new to this and haven’t a clue what I’m doing, I would add the div tags around the content that I want centered and then would add the CSS code to my pre-existing style sheet? or would I create a new css file altogether? Sorry if that’s a stupid question, and thanks again for all of the help!



    Forum Moderator

    You should really use a Child Theme or Custom CSS for any changes – otherwise your changes will be overwritten when WP is updated. If you only need to make CSS changes, a plugin such as my Custom CSS Manager is a good one. Then you can add the CSS above there.

    If you want to change other theme files (i.e. php files), then see:

    As WPyogi said, the best if you want make changes on your templae is use some plugin as Custom CSS Manager or create a child theme.

    In this chase is enough with use CSS Manager, cause it’sa not a big deal, just a detail, but if you want really make a big custom on template, then should create a child theme

    i see you created a .centerme class div. it’s not necessary and maybe isn’t a good idea cause you’re editing your PHP files and all changes will be overwrited on a template’s update. I seee it’s working now, but it’s better if you edit css of existing containers using CSS Manager…

    The problem editing a template by another coder is you’re never sure about how it works, and a big mess is waiting under every edit 😀

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to Vertically Center an Image With Text Below It?’ is closed to new replies.