By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,493 Members | 1,920 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,493 IT Pros & Developers. It's quick & easy.

How to wrap up text shown with a table cell after a certain length intervals ?

P: 2
I have a requirement to wrap a text shown within a table after 60 characters

here is what I have
<table width="50%">
<tr>
<td width="25%">
This is a text that needs to be wrapped after every 60 characters.This is a text that needs to be wrapped after every 60 characters.This is a text that needs to be wrapped after every 60 characters.
</td>
</tr>
<.table>
The text wraps automatically in IE but I need to make it wrap exactly at sixty characters. So a 240 character long text should end up getting diplayed in 4 lines in IE within the table cell.How do I adjust this table width? Is there any way to do this using CSS or any other ways.

Thanks a lot for your help
Apr 3 '07 #1
Share this Question
Share on Google+
2 Replies


Expert 100+
P: 1,892
I have a requirement to wrap a text shown within a table after 60 characters

here is what I have
<table width="50%">
<tr>
<td width="25%">
This is a text that needs to be wrapped after every 60 characters.This is a text that needs to be wrapped after every 60 characters.This is a text that needs to be wrapped after every 60 characters.
</td>
</tr>
<.table>
The text wraps automatically in IE but I need to make it wrap exactly at sixty characters. So a 240 character long text should end up getting diplayed in 4 lines in IE within the table cell.How do I adjust this table width? Is there any way to do this using CSS or any other ways.

Thanks a lot for your help
Yes, you can apply styles to a table here is a link that should help. Here is another.
Apr 3 '07 #2

drhowarddrfine
Expert 5K+
P: 7,435
You would have to do a little manipulating of the font sizes because you want to make the size of the cell relative to the number of characters and the number of characters on a line is related to the size of the font.

You can set the size of the cell using em which is the size of the current font but if you set the width of the cell as 600px but each character is 1em wide and an em equals 16px then 60 characters equals 960px.

So a bit of a juggling act there.
Apr 3 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.