Skip to content Skip to sidebar Skip to footer

Why Is My Table Cell Width Wrong In Chrome?

I've got a table with two rows. The first row just has three cells. The second row has two cells, with the first cell containing another table that needs to fill the whole cell. &l

Solution 1:

Two things you should do:

  • On the table element, use table-layout: fixed;
  • Insert columns and give them a width
    • (You could also assign width to table headers/cells of the first row)

Like this:

<table border="1" style="table-layout: fixed; width: 100%;">
    <colgroup>
        <col style="width: 205px;">
        <col style="width: auto;">
          <!-- Use "width: auto;" to apply the remaining (unused) space -->
        <col style="width: 5px">
    </colgroup>

    <tr>
        <td>1</td>
        <td>2</td>
        <td>3</td>
    </tr> 

    <!-- Etc. -->

Post a Comment for "Why Is My Table Cell Width Wrong In Chrome?"