473,770 Members | 2,069 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 13142
On Mar 21, 3:07 pm, "lister" <listerofsme... @hotmail.comwro te:
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_do m_style_overflo w

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.comwrot e:
On Mar 21, 3:07 pm, "lister" <listerofsme... @hotmail.comwro te:
>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.tu t.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.contac t" <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
4359
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 square, line, or rectangle should all be considered as part of the same inline block? What i want it for is I'm using a two column table to display a series of images with text, and I want the images opposite the centre of each text section, with...
2
36268
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 truncated) rather than wrapping to create a new line in the cell. If the actual content of the clipped cell is "Hello world", it should look something like this: +--------+------------+ |Hello wo|second cell |
1
2521
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 was: Import Namespace="System.Web.Mail" Dim aa as new StringBuilder(600010) Dim i as Integer
63
3972
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 the features for coding, such as syntax highlighting, etc.) but not a full IDE with all the fancy jazz (GUI developer, UML diagrams, etc.). Ideally, it would be something I could even put on a flash drive and move from computer to computer, but...
6
1165
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 { white-space: pre-wrap; /* css-3 */ white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ white-space: -pre-wrap; /* Opera 4-6 */
7
2694
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 line hight for a column. For example, if i fed the script an an essay, it would format the text like a newspaper on the screen. Text processing is very new to me, any ideas on how I could achieve a multi-columned text formatter. Are there any...
2
2297
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 Values from database. The problem i was getting is if the text length that is replaced is more than the cell length it was not displaying at all rather "Display Text Cannot Span More Than One Line" is displayed in that cell. I need to wrap the...
6
2965
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 truncate. Many thanks, Lister
11
7654
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 characters into the display myself - but that's not the main issue at this time. I've tried a scrolling multiline text box but once the original viewable area fills up and it starts scrolling the flashing of the entire area drives me nuts. The...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10260
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9906
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8933
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6712
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.