![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
The numbers are formatted with commas to delimit the thousands (e.g. 2,481,000). If the window is too narrow to hold the full-width of the table, then I would like the text of each number to be word-wrapped at the commas, |
#3
| |||
| |||
|
|
Is it possible to use CSS to direct a browser to wrap text on something in addition white-space characters? No. |
#4
| |||
| |||
|
|
Is it possible to use CSS to direct a browser to wrap text on something in addition white-space characters? |
|
The numbers are formatted with commas to delimit the thousands (e.g. 2,481,000). If the window is too narrow to hold the full-width of the table, then I would like the text of each number to be word-wrapped at the commas, so that the right end of the table doesn't extend beyond its div container. |
#5
| |||
| |||
|
|
axlq wrote: Is it possible to use CSS to direct a browser to wrap text on something in addition white-space characters? You can use word-wrap: break-word which is a Microsoft invention, now also supported by some other browsers and included in a CSS 3 draft. But it means brute breaking: break at any character, when the available width has been filled. There's also a different approach that requires extra markup but gives much better control: use generated content to add a zero-width space, ZWSP. Assuming you would want to break after a comma, for example, you would write the comma as span class="wbr">,</span and use CSS code .wbr:after { content: "\00200B"; } This looks contrived as compared with using ZWSP in content, e.g. using a character reference, as in ,​ However, the CSS approach has the advantage of not causing confusion on browsers that don't understand ZWSP - we can hope that any browser that understands generated content can handle ZWSP, too. (See also http://www.cs.tut.fi/~jkorpela/html/nobr.html for additional notes, minor and major, partly dated.) The numbers are formatted with commas to delimit the thousands (e.g. 2,481,000). If the window is too narrow to hold the full-width of the table, then I would like the text of each number to be word-wrapped at the commas, so that the right end of the table doesn't extend beyond its div container. I would suggest a redesign of the page rather than such tricks. Breaking numbers that way tends to be counter-productive. -- Yucca, http://www.cs.tut.fi/~jkorpela/ |
#6
| |||
| |||
|
|
Thanks for the detailed reply. I didn't know about that trick with the zero-width space. It looks kind of kludgey, so I don't think I'll use it, but at least I just learned something! |
![]() |
| Thread Tools | |
| Display Modes | |
| |