0

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

thirtydot
  • 224,678
  • 48
  • 389
  • 349
charlie_cat
  • 1,830
  • 7
  • 44
  • 73

4 Answers4

3

Things you're doing wrong:

Community
  • 1
  • 1
thirtydot
  • 224,678
  • 48
  • 389
  • 349
2

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.

kazinix
  • 28,987
  • 33
  • 107
  • 157
  • margin:auto; is for block elements. To center span you must apply text-align:center; to its parent. – MatTheCat Jul 14 '11 at 09:04
  • im afraid non of the above worked??? i dont unserstand? RAINBOWCODE
    THANK YOU,YOUR FORM HAS BEEN SUBMITTED please help? thank you
    – charlie_cat Jul 14 '11 at 09:39
1

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>
Mads Ohm Larsen
  • 3,315
  • 3
  • 20
  • 22
0

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

Marco
  • 129
  • 1
  • 1
  • 9