HashimR
HashimR

Reputation: 3843

HTML table column width problem

<table width="825" border="0" cellspacing="1" class="tableLines1" cellpadding="0">
   <tr>     
       <td align="left" valign="middle">Account / BIC</td>
       <td align="left" valign="middle">Name</td>
       <td align="left" valign="middle">Email Address</td
   </tr>
   <tr> 
       <td ><%=Data.getAccount())%></td>
       <td ><%=Data.getName())%></td>
       <td width="250px"><%=Data.getEmailAddress())%></td>
   </tr>
</table>

I have the following table. This data object get populated from database. The problem is when email address gets bigger the width of table also increases. For example

emailAddress = [email protected], [email protected], [email protected]

then html intelligently breaks it from spaces and make three two rows like this.

[email protected], [email protected], 
[email protected]

but what i want is that if emailAddress size increases a certain value table size i.e column width should remain constant.

[email protected], [email protected], 
[email protected]
ddddddddddd

To be more specific i want the data to be displayed as shown above!

Can anyone please guide me. Thanks !

Edited : I want html to intelligently decide the column widths itself. Just not itself increase the table width from the specified value !

Upvotes: 1

Views: 808

Answers (2)

alistair
alistair

Reputation: 1074

you can try wrapping your email address in a div with overflow set to hidden or scroll

<td width="250px"><div style="overflow:hidden; width:100%"><%=Data.getEmailAddress())%></div></td>

Upvotes: 1

Simone
Simone

Reputation: 21282

Use this CSS rule: word-wrap: break-word;

break-word means the text will wrap to next line.

word-wrap is supported in IE 5.5+, Firefox 3.5+, and WebKit browsers such as Chrome and Safari.

Upvotes: 2

Related Questions