Centering Header Logo

S1lv3rdo7

Regular Member
Joined
Jul 17, 2010
Messages
486
Reaction score
325
I'm trying to center a logo on the top of a wordpress blog. The theme is simple press. I went into the header.php and tried to adjust it, but it just moves it further to the right.

Code:
<div class="wrapper">
  <a href="<?php bloginfo('url'); ?>"><?php $logo = (get_option('simplepress_logo') <> '') ? get_option('simplepress_logo') : get_bloginfo('template_directory').'/images/logo.png'; ?>
    <align=center><img src="<?php echo esc_url($logo); ?>" alt="Logo" id="logo"/></a></align>
    
    <div id="navwrap">
        <span class="nav_top"></span>
        <?php $menuClass = 'nav superfish';

I won't post the url because I don't want someone saying I'm just trying to advertise. Thanks for any help you guys can offer.
 
Since I am not an expert at coding I use Dreamweaver to help me about these issues.

I know not the best answer you would expect but I thought to share :D
 
<div align="center">logo</div>
or
<div style="margin:0 auto;">logo</div>

Don't really know what else will do it.
 
Since I am not an expert at coding I use Dreamweaver to help me about these issues.

I know not the best answer you would expect but I thought to share :D

<div align="center">logo</div>
or
<div style="margin:0 auto;">logo</div>

Don't really know what else will do it.

Thanks for the help guys I don't know if this is the right way to do it or not but I used this code. Turns out it was in the .css not the header.php

Code:
#logo { border: none;  display: block; margin-left: auto; margin-right:auto}

Then I had to make adjustments vertically, so I just went and made the .png bigger in photoshop lol!
 
I'd suggest using firefox with the firebug plugin. Depending on how the theme creator built it and what else is in the header area there are different answers. With firebug you can play around with the CSS and see what works.
 
Thanks for the help guys I don't know if this is the right way to do it or not but I used this code. Turns out it was in the .css not the header.php

Code:
#logo { border: none;  display: block; margin-left: auto; margin-right:auto}

Then I had to make adjustments vertically, so I just went and made the .png bigger in photoshop lol!

instead of declaring a margin for both left and right just use margin:0 auto; far better
 
Thanks for the help guys I don't know if this is the right way to do it or not but I used this code. Turns out it was in the .css not the header.php

Code:
#logo { border: none;  display: block; margin-left: auto; margin-right:auto}

Then I had to make adjustments vertically, so I just went and made the .png bigger in photoshop lol!

To make vertical adjustments, use the code below.

Code:
#logo { border: none;  display: block; margin-left: auto; margin-right:auto; [B]padding-top:10px;[/B] }

Change the padding-top to an appropriate value.
 
just add margin:0 auto; in logo class in css. If it is still not helpful then send me PM. I will solve it for you.
 
Display:block, margin:0 auto; and make sure to specify your width to center an image using CSS.
 
Back
Top