Jump to content

Archived

This topic is now archived and is closed to further replies.

Pompeylad

Alignment Issue

Recommended Posts

Hi,

 

I have placed a menu in my header but it will not align to center.

 

<TABLE  BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=100>
                   <TR class="header" VALIGN="BOTTOM" ALIGN="center">

 

Anybody know what's wrong??

 

Thanks,

Pompeylad.


PHP?!? Long live HTML!!!! But then again we never stop learning.

Share this post


Link to post
Share on other sites

Try wrapping your table in a div align instead, like this:

 

<div align="center"><table border="0" cellspacing="0" cellpadding="0" width="100%">
    <tr>
         <td>contents here</td>
    </tr>
 </table></div>

 

HTH,

 

Terry


Terry Kluytmans

 

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

 

Add order total to checkout_shipment

Add order total to checkout_payment

Add radio buttons at checkout_shipping (for backorder options, etc.)

Duplicate Table Rate Shipping Module

Better Product Review Flow

 

* If at first you don't succeed, find out if there's a prize for the loser. *

Share this post


Link to post
Share on other sites

You can align any page element by defining it in the appropriate place in your stylesheet. I personally have found that defiing it in the html is never very successful.

 

Example:

Where the class is, say, <TABLE class="header" ... or <TR class="header" ...

your stylesheet you would define it thus...

TABLE.header {
text-align: left;
}

or

TR.header {
? text-align: left;
}

etc.

 

HTH


If it looks like a dog, smells like a dog and barks like a dog ... then it's probably a cat trying to sell you something. (?2003 R. Ellison)

 

Independence is the privilege of a mature mind ... not a toy for children to play with.

Share this post


Link to post
Share on other sites

I have tryed all of the above, but nothing seems to work. Does anybody else have any tips?

 

Thanks,

Pompeylad


PHP?!? Long live HTML!!!! But then again we never stop learning.

Share this post


Link to post
Share on other sites

Can you post a URL, or the code that you're trying to center? It's much easier to troubleshoot that way...

 

Terry


Terry Kluytmans

 

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

 

Add order total to checkout_shipment

Add order total to checkout_payment

Add radio buttons at checkout_shipping (for backorder options, etc.)

Duplicate Table Rate Shipping Module

Better Product Review Flow

 

* If at first you don't succeed, find out if there's a prize for the loser. *

Share this post


Link to post
Share on other sites

This is my extraheader.php

 

<TABLE  BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH="100">
                   <TR class="header" align="center">

**Table Info**
                   </TR>
               </TABLE>

 

And this is the section of my header.php which contains the extreheader.php

 

 <tr class="header">
   <td valign="middle"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'Gadget-XS-2.gif', 'Gadget XS') . '</a>'; ?></td>
<!-- additional header bit //-->
<?php require(DIR_WS_INCLUDES . 'extraheader.php'); ?>
<!-- additional header bit_eof //-->
<table border="0" width="100%" cellspacing="0" cellpadding="0">    
<td align="center" valign="bottom"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_spacer_10x10.gif', HEADER_TITLE_CHECKOUT) . '</a>'; ?>  </td>
 </tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="1">
 <tr class="headerNavigation">
   <td class="headerNavigation">  <?php echo $breadcrumb->trail(' » '); ?></td>
   <td align="right" class="headerNavigation"><?php if (tep_session_is_registered('customer_id')) { ?><a href="<?php echo tep_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_LOGOFF; ?></a>  |  <?php } ?><a href="<?php echo tep_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a>  |  <a href="<?php echo tep_href_link(FILENAME_SHOPPING_CART); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a>  |  <a href="<?php echo tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CHECKOUT; ?></a>   </td>
 </tr>
</table>

 

Hope this helps,

Pompeylad.


PHP?!? Long live HTML!!!! But then again we never stop learning.

Share this post


Link to post
Share on other sites

Have you tried changing this:

 

<TABLE  BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH="100">
                  <TR class="header" align="center">

**Table Info**
                  </TR>
              </TABLE>

 

to this:

 

<div align="center"><TABLE  BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH="100">
                  <TR class="header" align="center">

**Table Info**
                  </TR>
              </TABLE></div>

 

Also, have you set alignment to center in your <td> cells, like this:

 

<div align="center"><TABLE  BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH="100">
                  <TR class="header" align="center">
                     <td align="center">** first table cell **</td>
                  </TR>
              </TABLE></div>

 

Also, in your header.php file, you end with a closing </td> before calling your extraheader.php file, but you don't close off the table row with a </tr>. Is the information in your extraheader.php supposed to be another cell as part of the same row as the preceding code? If not, then you should close it off with a </tr> and </table> before your extraheader.php table gets inserted.

 

HTH,

 

Terry


Terry Kluytmans

 

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

 

Add order total to checkout_shipment

Add order total to checkout_payment

Add radio buttons at checkout_shipping (for backorder options, etc.)

Duplicate Table Rate Shipping Module

Better Product Review Flow

 

* If at first you don't succeed, find out if there's a prize for the loser. *

Share this post


Link to post
Share on other sites

Hmm - don't know if you specifically wanted it to be in that particular place in the header, but it's different to mine

 

My code in header.php looks like this:

<table border="0" width="100%" cellspacing="0" cellpadding="0">
 <tr class="header">
   <td valign="middle" align="center"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'oscommerce.gif', 'Cheap Sheet Music') . '</a>'; ?></td>
 </tr>
</table>

<!-- additional header bit //-->
<?php require(DIR_WS_INCLUDES . 'extraheader.php'); ?>
<!-- additional header bit_eof //-->

<table border="0" width="100%" cellspacing="0" cellpadding="1">
 <tr class="headerNavigation">
   <td class="headerNavigation"><?php echo $breadcrumb->trail(' ? '); ?></td>
   <td align="right" class="headerNavigation">

 

Secondly, open up extraheader.php and right at the very beginning, before the <table>, put <CENTER> and at the very very end, after the </table> put </CENTER>

 

Simple, but it works for me.


Questions not being answered? mecry.gif

Try here first:

Search | Help documents

Share this post


Link to post
Share on other sites

×