1
<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 !

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

9 Comments

You need to set a fixed width to cells in order to get working this property
hmmmm. but i want html to intelligently decide the column widths itself. Just not increase the table width from the specified value !
In this way you just can't use word-wrap to solve your problem.
i applied it to both <td>'s i.e the heading and the data <td>'s. still not working ! :(
need to set width of all cells ? or just the email cell?
|
1

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>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.