Hi all

I managed to make my site logo centered in firefox using

  <?php if ($logo) : ?>
  <table align="center"><tr><td><a href="/<?php print url() ?>" title="Index Page"><img src="/<?php print($logo) ?>" alt="$
  <?php endif; ?>

in my theme page.tpl.php file. Sadly, this trick doesnt work in ie :(

Any ideas? A simple < c e n t e r > tag doesnt work.

Thanks

Charly

Comments

charly’s picture

my copy-paste cut a line end. Here's my actual code:

  <?php if ($logo) : ?>
  <table align="center"><tr><td><a href="/<?php print url() ?>" title="Index Page"><img src="/<?php print($logo) ?>" alt="Logo" /></a></td></tr></table>
  <?php endif; ?>                       
potential’s picture

don't modify that file. you want to style pages using style.css in your theme directory. Look for div id #logo.

xand’s picture

Show us the page?

and you should definitely be trying to use styles.css rather than editting the template for this..

note that, depending on what exactly you're trying to do, you may need to edit the template, and the changes required might be more significant that those you made.

charly’s picture

I had no logo related section in my style.css file. So ive tried to put a section #logo as seen in the bluemarine style.css file.
Ive tried to add "text-align: center;" and "horizontal-align: midlle;" but nothing works.

I dont know the syntax for these files, can you tell me which line should i add?

thanks

ps: my site is still not published, so the firewall will keep you away if i try to make you connect

Anonymous’s picture

Not really drupal related, but...

The best way is to put your logo in it's own div and then in the css use margin: auto;

<div id="logo">
     <img src="/...">
</div>

style.css:

#logo {
     margin: auto;
}
charly’s picture

I managed to do the trick :)

In fact there was an "header" div already present. I just had to modify it in the style.css file (dont blame me, please). Here's what i have:

#header {
  position: relative;
  padding: 1em 0 0 0;
  margin: 0;
}
#header img {
  margin: 0 0.75em 0 1em;
  display: block;
  float: center;
  margin-left: auto;
  margin-right: auto;
}

Thanks for your help!

xand’s picture

yay :)

sys6x’s picture

sorry, I don't know one cent of CSS and uh I didn't see the #header in my styles.css file, does that depend on the theme or..? I use the marvinclassic theme.

thanks

sangamreddi’s picture

Marvintheme dosen't have the class or id.

Sunny
www.gleez.com

snsace’s picture

Charly,

Did you add all of that to your Bluemarine style.css file?

The only Header reference in my .css is this:

#header {
  background-color: #FBFBF9;
}

Immediately following this is my logo references:

#logo {
  vertical-align: middle;
  border: 0;
}
#logo img {
  float: left;
  padding: 0em 1.0em 0em 1em;
  border: 0;
}

I am just trying to center my custom logo. I am not using the default logo. Some say to edit the page.tpl.php file but some say don't.

The part of my page.tpl.php file that references the logo is this:

<td id="logo">
      <?php if ($logo) { ?><a href="<?php print $base_path ?>" title="<?php print t('Home') ?>"><img src="<?php print $logo ?>" alt="<?php print t('Home') ?>" /></a><?php } ?>
      <?php if ($site_name) { ?><h1 class='site-name'><a href="<?php print $base_path ?>" title="<?php print t('Home') ?>"><?php print $site_name ?></a></h1><?php } ?>
      <?php if ($site_slogan) { ?><div class='site-slogan'><?php print $site_slogan ?></div><?php } ?>
    </td>
snsace’s picture

Sorry, I didn't notice this was an old discussion. I moved this question to a more recent thread.