473,385 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

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
7 13112
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: skullcap | last post by:
Is there any way using HTML 4.01 of wrapping text and other inline elements into an 'L' or 'C' shaped space in a table - i.e. telling the browser that a series of table cells which don't form a...
2
by: Paul E Collins | last post by:
I need to 'clip' text in a table cell instead of wrapping it, such that (i) the cell keeps its specified fixed width and (ii) any text that overflows the cell should be 'clipped' (hidden or...
1
by: Jitesh Sinha | last post by:
Hi, I am running Windows 2003/ IIS 6.0. I was stuck with rather a abnormal behaviour of System.Web.mail class. It was truncating the message body after 3,071 character. The code i was testing...
63
by: John Salerno | last post by:
I know there's a request for a good IDE at least once a week on the ng, but hopefully this question is a little different. I'm looking for suggestions for a good cross-platform text editor (which...
6
by: Markus Ernst | last post by:
Hi Searching for a possibility to display some text with preserved white space and line breaks, but with long lines being wrapped, I found this CSS declaration, which I found helpful: pre {...
7
by: Leon | last post by:
Hi, I'm creating a python script that can take a string and print it to the screen as a simple multi-columned block of mono-spaced, unhyphenated text based on a specified character width and...
2
by: amitp | last post by:
hi i'm using MS Word2003 for my VB application which is a report. The word documents contains tables and the cells inside the table contain some fields. My application replaces the field values with...
6
by: lister | last post by:
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...
11
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post by:
Hello, I know I sound like a one-note Johnny on this but I'm still looking for a solution. I need to display characters coming in from a serial port or a socket. I also need to be able to type...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.