To set the cell width and height, use the CSS style. The height and width attribute of the <td> cell isn't supported in HTML5. Use the CSS property width and height to set the width and height of the cell respectively.
This can be done by setting table-cell style to width: auto , and content empty. The columns are now equal-wide, but holding no content.
To adjust column width automatically, click AutoFit Contents. To adjust table width automatically, click AutoFit Window.
You first declare the table with the <table> markup, and then the rows with the <tr> markup. (table row.) Inside each row, you can declare the data containers <td> . (table data).
In your case, you'd do something like
<tr>
<td colspan="5">This text should be as long as the entire table's width...</td>
</tr>
The colspan
attribute says how many columns the cell should take up. It should work in all browsers that support tables, as it's standard HTML.
In JavaScript, you'd set the colSpan
property of the cell, or call .setAttribute("colspan", the_number_of_columns)
on it. Either should work. But unless you're generating the cell dynamically, you should just include the colspan
attribute in your HTML.
For one cell to span all 5 columns,
<td colspan="5">Lorem Ipsum</td>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With