HighDots Forums  

Preventing Wrapping In Text

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Preventing Wrapping In Text in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
CJM
 
Posts: n/a

Default Preventing Wrapping In Text - 01-11-2006 , 04:53 AM






I have an application which returns telephone numbers along with other
information. I leave the table that holds this information alone to resize
itself, but in many cases it causes telephone numbers to wrap.

I'd like these numbers to remain on one line, so either the column should
widen or they should be moved to a new line in the cell. However, previous
attempts to enforce this have failed - clearly I'm not pressing the right
buttons.

I just want to be able to enclose the numbers in a <SPAN> and style it such
that that span either wont wrap or has a minimum width. Needless to say, I'd
like as simple a cross-browser solution as possible.

Any ideas?

Thanks in advance

Chris

--
cjmnews04 (AT) REMOVEMEyahoo (DOT) co.uk
[remove the obvious bits]



Reply With Quote
  #2  
Old   
Spartanicus
 
Posts: n/a

Default Re: Preventing Wrapping In Text - 01-11-2006 , 05:52 AM






"CJM" <cjmnew04 (AT) REMOVEMEyahoo (DOT) co.uk> wrote:

Quote:
I have an application which returns telephone numbers along with other
information. I leave the table that holds this information alone to resize
itself, but in many cases it causes telephone numbers to wrap.

I'd like these numbers to remain on one line, so either the column should
widen or they should be moved to a new line in the cell. However, previous
attempts to enforce this have failed - clearly I'm not pressing the right
buttons.
http://www.w3.org/TR/CSS21/text.html#white-space-prop

--
Spartanicus


Reply With Quote
  #3  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: Preventing Wrapping In Text - 01-11-2006 , 12:19 PM



"CJM" <cjmnew04 (AT) REMOVEMEyahoo (DOT) co.uk> wrote:

Quote:
I have an application which returns telephone numbers along with other
information. I leave the table that holds this information alone to
resize itself, but in many cases it causes telephone numbers to wrap.
There are several ways to achieve that. The CSS method is to set
white-space: nowrap for those <td> elements that contain a phone number.
Achieving this is a bit clumsy, but it's doable. In fact, it is sufficient to
prevent line breaks in the _longest_ cell content, if you can identify the
longest one. Alternatively, you could use HTML markup: <td nowrap>.
Or you could write the number using no-break spaces, perhaps presented as
entity references, e.g. <td>+358&nbsp;9&nbsp;40&nbsp;844&nbsp;8617</td>.

Quote:
I just want to be able to enclose the numbers in a <SPAN> and style it
such that that span either wont wrap or has a minimum width.
Why would you use <SPAN> if the number occupies a table cell, which is itself
a styleable element.

--
Yucca, http://www.cs.tut.fi/~jkorpela/


Reply With Quote
  #4  
Old   
Jasen Betts
 
Posts: n/a

Default Re: Preventing Wrapping In Text - 01-12-2006 , 03:25 AM



On 2006-01-11, CJM <cjmnew04 (AT) REMOVEMEyahoo (DOT) co.uk> wrote:
Quote:
I have an application which returns telephone numbers along with other
information. I leave the table that holds this information alone to resize
itself, but in many cases it causes telephone numbers to wrap.
have your application replace any spaces in the telephoine numbers with the
non-breaking space &nbsp; leaving regular spaces between the telephone
numbers only.

Quote:
I just want to be able to enclose the numbers in a <SPAN> and style it such
that that span either wont wrap or has a minimum width. Needless to say, I'd
like as simple a cross-browser solution as possible.

Any ideas?
there's an attribute you can use for that but I forget what it is.

--

Bye.
Jasen


Reply With Quote
  #5  
Old   
Tony
 
Posts: n/a

Default Re: Preventing Wrapping In Text - 01-12-2006 , 12:33 PM



Jasen Betts wrote:
Quote:
On 2006-01-11, CJM <cjmnew04 (AT) REMOVEMEyahoo (DOT) co.uk> wrote:
I have an application which returns telephone numbers along with other
information. I leave the table that holds this information alone to resize
itself, but in many cases it causes telephone numbers to wrap.

have your application replace any spaces in the telephoine numbers with the
non-breaking space &nbsp; leaving regular spaces between the telephone
numbers only.

I just want to be able to enclose the numbers in a <SPAN> and style it such
that that span either wont wrap or has a minimum width. Needless to say, I'd
like as simple a cross-browser solution as possible.

Any ideas?

there's an attribute you can use for that but I forget what it is.
white-space: nowrap



Reply With Quote
  #6  
Old   
condor
 
Posts: n/a

Default Re: Preventing Wrapping In Text - 01-13-2006 , 10:45 AM



I know it is oldfashioned and not CSS. But I thought that at least it
should be mentioned: <NOBR>


Reply With Quote
  #7  
Old   
Jim Moe
 
Posts: n/a

Default Re: Preventing Wrapping In Text - 01-13-2006 , 12:54 PM



condor wrote:
Quote:
I know it is oldfashioned and not CSS. But I thought that at least it
should be mentioned: <NOBR

While most (all?) browsers support <nobr>, it is not a valid HTML element.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)


Reply With Quote
  #8  
Old   
CJM
 
Posts: n/a

Default Re: Preventing Wrapping In Text - 01-16-2006 , 03:50 AM




"Jukka K. Korpela" <jkorpela (AT) cs (DOT) tut.fi> wrote

Quote:
Why would you use <SPAN> if the number occupies a table cell, which is
itself
a styleable element.

Because I was busy clutching at straws when previous solutions failed! lol




Reply With Quote
  #9  
Old   
CJM
 
Posts: n/a

Default Re: Preventing Wrapping In Text - 01-16-2006 , 03:52 AM



All,

Thanks for your responses, and apologies for the delay in feedback.

I followed Spartanicus's prompt response and used white-space:nowrap in
appropriate table cells, and it worked a treat.

Cheers

Chris



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.