| Author |
Message |
Ben Guest
Tue Apr 10, 2007 3:01 pm |
Post subject: custom WORD-BREAK |
|
 |
 |
 |
Hi,
Does anyone know if there is a way of specifying a custom "WORD-BREAK"
in css? I can set it to normal, which breaks on spaces, or All, which
breaks anywhere, but ideally I would like it to break on spaces or
commas only...
Is there a way, shoer of processing the strings to turn all commas
into spaces beforehand?
Cheers,
ben |
|
| Back to top |
|
 |
|
 |
| Author |
Message |
Jukka K. Korpela Guest
Tue Apr 10, 2007 4:12 pm |
Post subject: Re: custom WORD-BREAK |
|
 |
 |
 |
Scripsit Ben:
| Quote: | Does anyone know if there is a way of specifying a custom "WORD-BREAK"
in css?
|
There is none. In fact, the word-break property isn't part of CSS at all; it
is just in a CSS 3 draft and partly implemented in IE.
| Quote: | I can set it to normal, which breaks on spaces, or All, which
breaks anywhere, but ideally I would like it to break on spaces or
commas only...
|
You cannot do such things in CSS. As a practical move, you could simply add
<wbr> after each comma. (Stay tuned to mourning complaints about <wbr> being
nonstandard. It's not allowed to mention it without making a liturgic remark
about its not being in HTML specifications.)
| Quote: | Is there a way, shoer of processing the strings to turn all commas
into spaces beforehand?
|
If you turn commas into spaces, you change the content. What's really
relevant here? As usual, a URL etc.
The odds are that you should simply stop creating the problem (either by
removing artificial width restrictions or by doing something to long strings
with no whitespace), but it's difficult to help with that without seeing how
you are now creating it.
--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/ |
|
| Back to top |
|
 |
|
 |
| Author |
Message |
Toby A Inkster Guest
Tue Apr 10, 2007 4:46 pm |
Post subject: Re: custom WORD-BREAK |
|
 |
 |
 |
Ben wrote:
| Quote: | Is there a way, shoer of processing the strings to turn all commas
into spaces beforehand?
|
Wouldn't a better conversion be from a comma to "comma-space".
In PHP, this would be:
$text = str_replace(',', ', ', $text);
or even better:
$text = preg_replace('/\,([^\s])/', ', $1', $text);
Anyone know if Internet Exploder supports ZWSP yet?
$text = preg_replace('/\,([^\s])/', ',$1', $text);
--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux
* = I'm getting there! |
|
| Back to top |
|
 |
|
 |
| Author |
Message |
Ben Guest
Tue Apr 10, 2007 5:37 pm |
Post subject: Re: custom WORD-BREAK |
|
 |
 |
 |
On 10 Apr, 12:46, Toby A Inkster <usenet200...@tobyinkster.co.uk>
wrote:
| Quote: | Ben wrote:
Is there a way, shoer of processing the strings to turn all commas
into spaces beforehand?
Wouldn't a better conversion be from a comma to "comma-space".
In PHP, this would be:
$text = str_replace(',', ', ', $text);
or even better:
$text = preg_replace('/\,([^\s])/', ', $1', $text);
Anyone know if Internet Exploder supports ZWSP yet?
$text = preg_replace('/\,([^\s])/', ',$1', $text);
--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux
* = I'm getting there!
|
I thought I might have to do that - you're right, it is a simple fix!
Cheers,
Ben |
|
| Back to top |
|
 |
|
 |
| Author |
Message |
Jukka K. Korpela Guest
Tue Apr 10, 2007 6:52 pm |
Post subject: Re: custom WORD-BREAK |
|
 |
 |
 |
Scripsit Toby A Inkster:
| Quote: | Anyone know if Internet Exploder supports ZWSP yet?
|
IE has kind-of supported ZWSP a long time, but up to IE 6 it wants to
_render_ its glyph, so things go wrong if the font in use doesn't contain an
(empty) glyph for it, displaying a rectangle instead. This seems to have
been fixed in IE 7. Thus, in terms of browser support, <wbr> is _far_ more
practical - it works on the great majority of browsers, and it does no harm
(no nasty rectangle) when it doesn't work.
--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/ |
|
| Back to top |
|
 |
Page 1 of 1 |
All times are GMT
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
| | |