I've adapted the BlueMarine theme so that the "menu" table cell in the header is on a new row below the logo. I've installed and configured the nice_menu module and have a nice menu :) inside the header block. But it is sitting on the left side of the table cell, and for the life of me I can't get it centered in the cell.

Here is a portion my page.tpl.php:

<table border="0" cellpadding="0" cellspacing="0" id="header">
  <tr>
    ...
  </tr>
  <tr>
    <td id="menu"><div><?php print $header ?></div></td>
  </tr>
</table>

And here is the menu CSS:

#menu {
  padding: 0em 1.0em 0 em 1.0em;
  text-align: center;
}

The HTML output is this:

<table border="0" cellpadding="0" cellspacing="0" id="header">
  <tr>
    <td id="logo">
      <a href="/carl/" title="Home"><img src="/carl/files/images/titlebar.jpg" alt="Home" /></a>                </td>
  </tr>
  <tr>
    <td id="menu"><div>  <div class="block block-nice_menus" id="block-nice_menus-1">
    <h2 class="title"><span class="nice-menu-hide-title">Primary links</span></h2>
    <div class="content"><ul class='nice-menu nice-menu-down' id='nice-menu-1'><li id='menu-27' class='menu-path-node-2'><a href="/carl/node/2" title="">About Us</a></li><li id='menu-28' class='menu-path-node-3'><a href="/carl/node/3" title="">Services</a></li><li id='menu-29' class='menuparent menu-path-node-5'><a href="/carl/node/5" title="">Portfolio</a><ul><li id='menu-31' class='menu-path-node-6'><a href="/carl/node/6" title="">Weddings</a></li><li id='menu-32' class='menu-path-node-7'><a href="/carl/node/7" title="">Events</a></li><li id='menu-33' class='menu-path-node-8'><a href="/carl/node/8" title="">Portraits</a></li><li id='menu-34' class='menu-path-node-9'><a href="/carl/node/9" title="">Close-up</a></li><li id='menu-35' class='menu-path-node-10'><a href="/carl/node/10" title="">Landscape</a></li></ul></li><li id='menu-30' class='menu-path-node-4'><a href="/carl/node/4" title="">Contact Us</a></li></ul></div>
 </div>
</div></td>
  </tr>
</table>

How do I get the contents of the "menu" table cell centered? BTW none of the following worked:

<td align="center" id="menu">...
<td align="center" id="menu"><div style="text-align: center;">...
<td align="center" id="menu"><div style="text-align: center;" align="center">...

Comments

anner’s picture

I got the text of my nice menu in my header to center by doing this:

#header {
  background-color: #69c;
  text-align: center;
}

but cannot get the menu itself to center despite a multitude of changes to the nice_menu.css that came with the module. If you figure that one out, please post it here. Thanks.

texas-bronius’s picture

I've not yet used nice_menu, but perhaps you're just falling prey to css specificity rules? I just had something similar happen to me: couldn't figure out why a particular rule was getting overridden. Turns out that a more specific css rule bears more weight than a less-specific rule. Try centering your things in your css alone, and be sure to specify things to override nice_menu.css declarations....
(a little reading on css specificity)

--
..happiness is point and click..

--
http://drupaltees.com
80s themed Drupal T-Shirts

anner’s picture

No, I was in the most specific CSS (the nice menu CSS and the menu specific item), it was just a battle with the positioning of the menu. I think I finally got it where I want it.

.block-nice_menus {
  line-height: normal;
  /*font-size: normal;*/
  /*position: relative;
  z-index: 10; */
  position: relative;
   left: 20%;
}