In some html cells (td) the text is wrapped because the size of the column is smaller than the size of the text on the cell. I don't want the text to be wrapped, I want the column width to expand so the wrapping don't happen!
How can I do that?
One final note, I only can use html code, no css :(
The expandable table can be achieved by using JavaScript with HTML. By Clicking on a row of the table, it expands and a sub-table pops up. When the user again clicks on that row the content will hide. This can be very useful when the data is complex but it is inter-related.
By using CSS, the styling of HTML elements is easy to modify. To fix the width of td tag the nth-child CSS is used to set the property of specific columns(determined by the value of n) in each row of the table.
Use the border-collapse property set to "collapse" and table-layout property set to "fixed" on the <table> element. Also, specify the width of the table. Then, set the word-wrap property to its "break-word" value for <td> elements and add border and width to them.
Automatically adjust your table or columns to fit the size of your content by using the AutoFit button. Select your table. On the Layout tab, in the Cell Size group, click AutoFit.
Confusing question, but I think you might be looking for the colspan="x" attribute.
<table>
<tr>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td colspan="2">fills both columns</td>
</tr>
</table>
Since you can't use CSS, how about:
<td nowrap="nowrap">
I'd prefer to use CSS here on the TD (white-space:nowrap) since the nowrap attribute on the TD element isn't supported HTML 4.01 Strict / XHTML 1.0 Strict.
Here's a quick jsFiddle example showing the effect. Take out the attribute and you can see the difference.
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