How do I set% s of td
to automatically increase or decrease the size by the number of characters? To prevent the text from ending up breaking line?
How do I set% s of td
to automatically increase or decrease the size by the number of characters? To prevent the text from ending up breaking line?
I do not know if I understand this very well, but to avoid breaking lines, just set the white-space property of CSS as nowrap
:
table tr > th,
table tr > td
{
padding: 10px;
border: #bbb 1px solid;
}
tr > td:first-child
{
white-space: nowrap;
}
<table>
<thead>
<tr>
<th>Texto sem quebrar</th>
<th>Texto comum</th>
</tr>
</thead>
<tbody>
<tr>
<td>Texto texto texto texto texto texto texto texto texto texto texto texto texto texto texto texto</td>
<td>Texto texto texto texto texto texto texto texto</td>
</tr>
</tbody>
</table>