IE6 or 7 does not conter the table??

Discussion in 'HTML & Website Design' started by eddiemoth, Jun 4, 2008.

  1. #1
    Does anybody know why IE6 or 7 don't center tables while Firefox and Operate display them correctly? IE would align the table to the left instead of center.
     
    eddiemoth, Jun 4, 2008 IP
  2. itcn

    itcn Well-Known Member

    Messages:
    795
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    118
    #2
    What are you using to center the table? <center> tags, or align="center", or are you wrapping it in a div with text-align: center?
     
    itcn, Jun 4, 2008 IP
  3. eddiemoth

    eddiemoth Peon

    Messages:
    75
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Here is my code. I used aling="center" to center the two pictures but on IE both pictures are ligned left. I appreciate your help.

    
    
    <table border="0" bordercolor="blue" width="100%">
      
      <tr><!--Picture Row-->
         <td align="center" width="300"><a href="http://www.angkorthom.us/uploads/forums/stung-sen.jpg"><img src="http://www.angkorthom.us/uploads/forums/stung_sen300.jpg" border="0"></a></td><!-- Picture 1 -->
         <td align="center" width="300"><a href="http://www.angkorthom.us/uploads/forums/vanneth640.jpg"><img src="http://www.angkorthom.us/uploads/forums/vanneth300.jpg" border="0" /></td><!-- Picture 2 -->
      </tr>
      <tr><!-- Description Row -->
         <td align="center" width="350">Kampong Thom Province is located 168 Km from Phnom Penh. Above is the picture of Stung Sen bridge which is in the song of Ms. Song Seng Horn called "Stung Sen Srok Khmer."
    </td><!-- Description of Picture1 -->
         <td align="center" width="350">Noy Vanneth, a famous singer that always sings the romantic songs, performed on TV5.
    </td><!-- Description of Picture2 -->
      </tr>
    </table>
    
    Code (markup):
     
    eddiemoth, Jun 5, 2008 IP
  4. itcn

    itcn Well-Known Member

    Messages:
    795
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    118
    #4
    OK, this works:

    
    <table border="1" bordercolor="blue" width="100%">
    <tr><!--Picture Row-->
    	<td align="center" width="50%"><a href="http://www.angkorthom.us/uploads/forums/stung-sen.jpg"><img src="http://www.angkorthom.us/uploads/forums/stung_sen300.jpg" border="0"></a></td><!-- Picture 1 -->
    	<td align="center" width="50%"><a href="http://www.angkorthom.us/uploads/forums/vanneth640.jpg"><img src="http://www.angkorthom.us/uploads/forums/vanneth300.jpg" border="0" /></td><!-- Picture 2 -->
    </tr>
    <tr><!-- Description Row -->
    	<td align="center" width="50%">Kampong Thom Province is located 168 Km from Phnom Penh. Above is the picture of Stung Sen bridge which is in the song of Ms. Song Seng Horn called "Stung Sen Srok Khmer."</td><!-- Description of Picture1 -->
    	<td align="center" width="50%">Noy Vanneth, a famous singer that always sings the romantic songs, performed on TV5.</td><!-- Description of Picture2 -->
    </tr>
    </table>
    
    Code (markup):
    You can't declare a relative width for the table (100%) and then fixed widths for the rows (300, 350). I just had to change the td width to 50% and IE centered them properly.
     
    itcn, Jun 5, 2008 IP
  5. eddiemoth

    eddiemoth Peon

    Messages:
    75
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    ITCN, it works. You are awesome. Thanks for your help.
     
    eddiemoth, Jun 5, 2008 IP
  6. itcn

    itcn Well-Known Member

    Messages:
    795
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    118
    #6
    No problem, glad to be of assistance :)
     
    itcn, Jun 5, 2008 IP
  7. Rickydavis

    Rickydavis Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    expert.....
    Have a long way to go...
     
    Rickydavis, Jun 6, 2008 IP
  8. FlowerMan

    FlowerMan Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    The best way is create diffrent style to ie6, ie7, ff
     
    FlowerMan, Jun 6, 2008 IP