Search code examples
javascripthtmlcsshtml-tableinternet-explorer-6

In an HTML table, how can I center the contents of the cells (not the table itself)?


Given that I'm allowed to use static JS and HTML tags (only those supported by IE6), how can I center the contents of the cells in an HTML table (not the table itself)?


Solution

  • Using the css style text-align: center;, either as an inline style (below) or as a css style applied to all <td> elements (as suggested in Joel's answer).

    <td style="text-align:center;">
        Table contents here
    </td>