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

Truncating text in a table rather than wrapping to a new line?

P: n/a
Is this possible?

I want fixed height table rows, but long text is wrapping around and
causing the cell, and thus the entire row, to increase in height.

I want any long text to simply truncate.

Many thanks,
Lister

Mar 21 '07 #1
Share this Question
Share on Google+
7 Replies


P: n/a
On Mar 21, 3:07 pm, "lister" <listerofsme...@hotmail.comwrote:
I want fixed height table rows, but long text is wrapping around and
causing the cell, and thus the entire row, to increase in height.
I want any long text to simply truncate.
overflow:hidden
----
http://msdn.microsoft.com/workshop/a...s/overflow.asp
http://www.w3schools.com/htmldom/pro...e_overflow.asp
Test:http://www.w3schools.com/js/tryit.asp?
filename=try_dom_style_overflow

Mar 21 '07 #2

P: n/a
Scripsit lister:
I want fixed height table rows,
Why? That seems to be the problem, so shouldn't you stop wanting that?
but long text is wrapping around and
causing the cell, and thus the entire row, to increase in height.

I want any long text to simply truncate.
The only safe way is to truncate the text when it is generated. Even then,
the width requirements will vary. Who knows how users set the font size?

Try starting from the original problem. How about telling it and revealing
the URL?

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Mar 21 '07 #3

P: n/a
On 2007-03-21, scripts.contact <sc*************@gmail.comwrote:
On Mar 21, 3:07 pm, "lister" <listerofsme...@hotmail.comwrote:
>I want fixed height table rows, but long text is wrapping around and
causing the cell, and thus the entire row, to increase in height.
I want any long text to simply truncate.

overflow:hidden
Yes, although generally you will need to put a <divinside the <tdand
set height and overflow on the <div>.
Mar 21 '07 #4

P: n/a
On Mar 21, 10:36 pm, "Jukka K. Korpela" <jkorp...@cs.tut.fiwrote:
Scripsit lister:
I want fixed height table rows,

Why? That seems to be the problem, so shouldn't you stop wanting that?
Because it looks crap otherwise. All my icons and buttons are designed
for that height.

Yes, I realise differing font sizes will effect row height, and might
even cause some genuine wrapping of important columns and that's fine
- I'm not going to force layout at the expense of useability. But for
this particular column it is not important to be able to see the
entire information, so I just want to show as much as there is room
for.
Mar 22 '07 #5

P: n/a
On Mar 21, 9:23 pm, "scripts.contact" <scripts.cont...@gmail.com>
wrote:
>
overflow:hidden
Thanks! I will give it a go.

Mar 22 '07 #6

P: n/a
Scripsit lister:
>>I want fixed height table rows,

Why? That seems to be the problem, so shouldn't you stop wanting
that?

Because it looks crap otherwise. All my icons and buttons are designed
for that height.
Then you apparently have to solve that problem too, as part of solving the
problem hat you created by fixed-height rows.
- I'm not going to force layout at the expense of useability. But for
this particular column it is not important to be able to see the
entire information, so I just want to show as much as there is room
for.
You haven't told _any_ specifics, such as a URL. It is therefore reasonable
to assume that the general advice is applicable: decide on some reasonable
length, and truncate server-side, where you can actually truncate at
meaningful places and include a truncation symbol such as "...".

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Mar 22 '07 #7

P: n/a
lister wrote:
Is this possible?

I want fixed height table rows, but long text is wrapping around and
causing the cell, and thus the entire row, to increase in height.

I want any long text to simply truncate.

Many thanks,
Lister
Do what you can to avoid this problem. In other words, don't try to fix
it unless you absolutely have to. Fix the problem that causing the
symptom instead.
Mar 22 '07 #8

This discussion thread is closed

Replies have been disabled for this discussion.