Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Prevent word wrap in a table cell
March 14, 2006, 11:39 pm
rate this thread
5 out of 5
5 out of 5
Hi, all! I have a question.
I am designing a listing similar to a phone book in HTML. Each listing has
periods following it, but they must extend to the end of the table cell, and
Is there any way to prevent the text from 1) wrapping within the table cell
and 2) causing the table cell to expand? In other words, the filler periods
must flow past the right boundary of the cell (but not be seen). Similar to:
[Ben's Car Shop.......................] [555-5555]
Any information is appreciated. Thanks!
Re: Prevent word wrap in a table cell
The big problem here is how to implement the periods. Several approaches have
been suggested on such matters in c.i.w.a.stylesheets. Whether the whole idea
is feasible on the WWW is debatable. In any case, it would be more like a
styling issue than HTML. You don't really want to have masses of periods as
_content_ of your pages.
In HTML, several ways:
a) <td>foo bar</td> (or with replaced by the no-break space
b) <td nowrap>foo bar</td> (suitable only if _all_ line breaks inside a cell
are to be suppressed)
c) <td><nobr>foo bar</nobr></td> (nonstandard but widely supported)
d) <td><pre>foo bar</pre></td> (has other effects as well, somewhat nastily)
In CSS, use white-space: nowrap.
In HTML, no. The CSS side of the matter belongs to our sister group. It's not
trivial, but you could use table-layout: fixed for the table, set the cell
width, and set overflow: hidden for the cell. This would imply that essential
information will be made invisible to some users unless you are very careful.
You didn't think of setting the width in pixels, did you?
Is this really about telephone numbers, or what?
The recommended (by ITU) notation for telephone numbers does not use hyphens
but spaces. You could use the no-break space character, which works well,
whereas the nonbreaking hyphen is poorly supported.
In the WWW context, phone numbers should be expressed in the international
notation (starting with "+"), unless limited to a single country or other
numbering area and clearly indicated as such.
(Telephone numbers could be made links, using the tel: scheme. This might be
nice in the future when (or if) browsers support tel: URLs and let the user
just click on a number to make a phone call or send a text message. Then
again, if it became common, spammers would try to make use of it.)
Yucca, http://www.cs.tut.fi/~jkorpela /
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
- » IDEAlliance Annouces Conference Program for XTECH 2006
- — Previous thread in » HTML Authoring Forum