0

Hi,

I have a simple table where I want all text to be aligned in the center of their respective cells. The code below works very well on Firefox, IE8, Chrome, BUT NOT on IE6

<table border="1" width="420">
    <tr>
      	<td align="center" width="140" height="10px" colspan="4"></td>
        <td align="center" width="140" height="10px" colspan="4"></td>
	<td align="center" width="140" height="10px" colspan="4"></td>
    </tr>
    <tr>
        <td align="center" width="105" colspan="3">X</td>
        <td align="center" width="105" colspan="3">X</td>
	<td align="center" width="105" colspan="3">X</td>
        <td align="center" width="105" colspan="3">X</td> <!-- this one is not centering in IE6 -->
    </tr>
</table>

The last X is not centering in IE6. I tried some css: text-align but it didn't work.

Any idea how to solve this?

Blaise

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by shaya4207
0

First off, a good thing to get used to when making a table is having 'cellpadding="0" cellspacing="0"' (except obviously when you want it different...

And now to answer your question, in <table> tage you need to specify how many columns you're having in it, which in this case would be 'cols="4"' since the second <tr> has for <td>s, and then in the first <tr> you should add '<td>&nbsp;</td>' to make it have a fourth column just like the second row, and that should work. In a case where you want one <td> should be the size of two <td>s in the next row, you give that <td> a 'colspan="2"'...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.