02 May 2008

Table Alignment, Table Formatting, TD width fixed, TD Width Constant

You might have seen Tables expanding with the data.

Example:

<table width="20px" border="1"><tr>

<td>Meet</td>

</tr></table>

The table is displayed with width 20px as the data entered is with lesser width

No Enter data as "Meet Meet Meet Meet Meet Meet Meet Meet Meet". You would

notice the table to increase in width … thus disturbing your page format and content.

What if you want its width to remain static all over the table so that just one

TD's width doesn't alter the Full table?

Just add the following style… to all the Td's of your table and see the Magic.

<table width="20px" border="1"><tr>

<td style="word-break:break-all;">Meet</td>

</tr></table>

Bingo !!! See the Magic.

Also ... try this

/* fix for long text breaking sidebar float in IE */

word-wrap: break-word;