alberzyzz alberzyzz - 3 years ago 75
CSS Question

Width of cell ignored

I have looked for many posts but I could not find an answer that suits this problem. I have tried with

table-layout:fixed
, changing widths to extreme values but the attribute
width
is still being ignored. Here is my code:

<table style="width:100%; table-layout:fixed; border: 1pt solid black;
border-collapse: collapse;" border cellpadding=3 cellspacing=0>
<tr>
<th align=center colspan="4"
style="width:100%; color:white; background-color:#475678; font-weight:bold;">
Oferta de traducción para: ' . $cliente . '
</th>
</tr>
<tr>
<td style="border-right:1pt solid black; width:10%;">Fecha</td>
<td align=center style="border-right:1pt solid black; width:10%;">Fecha</td>
<td style="border-right:1pt solid black; width:40%;"></td>
<td style="width:30%;">Fecha</td>
</tr>
</table>

Answer Source

the table-layout: fixed is the one that ignores your widths.

from MDN HTML table-layout says like this about the table-layout: fixed,

Table and column widths are set by the widths of table and col elements or by the width of the first row of cells. Cells in subsequent rows do not affect column widths.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download