charlie_cat
charlie_cat

Reputation: 1850

center tag not centering in IE7

i have this code and tried a few things but nothing wants to centre it in IE7?? all is ok with chrome and FF

<div id='div_phone_big'></div>
<div id='div_longgray_gradient'>
<form>
   <table class='menu_bar_table' width='100%'>
     <br></br>
     <tr>
     <center>
        <span class='spn_big_lightblue_rbc'>RAINBOW</span><span class='spn_big_black_rbc'>CODE</span>
     </center>
     </tr>
     <br></br>
     <tr>
     <center>
        <span class='spn_med_yellow_rbc' >THANK YOU,YOUR FORM HAS BEEN SUBMITTED</span>
     </center>
     </tr>
</table>
</form>
</div>

the two span tags have no alignment set in the CSS

what am i doing wrong please? thank you

Upvotes: 0

Views: 599

Answers (4)

Marco
Marco

Reputation: 136

tag doesn't center when some of his children uses the "float" property. Good Luck!

Upvotes: 0

kazinix
kazinix

Reputation: 30123

Don't use center tag, it's deprecated. Use CSS instead. You can do something like this:

<td style="text-align:center">data</td>

You forgot to add tag inside your . If you want to study the anatomy of a table go here http://w3schools.com/html/html_tables.asp

<tr> 
    <td style="text-align:center">
        <span class='spn_big_lightblue_rbc'>RAINBOW</span>
    </td>
    <td style="text-align:center">
        <span class='spn_big_black_rbc'>CODE</span> 
    </td>
</tr> 
<tr> 
    <td style="text-align:center" colspan="2">
        <span class='spn_med_yellow_rbc' style="margin-left:auto;margin-right:auto;">THANK YOU,YOUR FORM HAS BEEN SUBMITTED</span> 
    </td>
</tr>

Also, don't use table for layout. Table is intended for tabular data, use CSS instead.

Upvotes: 2

Mads Ohm Larsen
Mads Ohm Larsen

Reputation: 3735

I might be wrong, but I think that you can't use <center> inside a <tr>.

Instead, use either the align attribute for the tr, or use CSS to center it

<tr align="center">
  <td>text</td>
</tr>

or

<tr style="text-align: center;>
  <td>text</td>
</tr>

Upvotes: 1

thirtydot
thirtydot

Reputation: 228212

Things you're doing wrong:

Upvotes: 3

Related Questions