Re: How to wrap text in <p> tag if the text has no spaces and is very long
On 2008-03-30, Jukka K. Korpela <jkorpela@cs.tut.fi> wrote:
> Scripsit Ben C:
>
>>><p>VeryVeryLongVeryVeryLongVeryVeryLongVeryVery LongVeryVeryLongVeryVeryLongVeryVeryLongVeryVeryLo ngVeryVeryLongVeryVeryLongVeryVeryLongVeryVeryLong VeryVeryLongVeryVeryLongVeryVeryLongVeryVeryLongVe ryVeryLongVeryVeryLong</
>>> p>
>
> This first question is: why would anyone write such a monstrosity?
Often because it's a URL generated by something like a content
management system that requires at least one unique URL for each atom in
the universe.
> The second question is: if you would like it to be broken by a
> browser, should the browser read your mind to decide whether it should
> hyphenate or just break it?
>
>> The only way to make it wrap in browsers is to put zero-width breaking
>> spaces in.
>
> No it isn't, as you describe later. Besides, it is up to browsers to
> decide whether they automatically hyphenate words. Currently they have
> decided not to. There is nothing in CSS as currently defined to
> suggest either hyphenation or breaking strings without hyphenation-
Well, in the sense that CSS doesn't define exactly what a "line-breaking
opportunity" is. But it does imply that browsers should only ever break
lines at line-breaking opportunities, and that what counts as a
line-breaking opportunity doesn't change just because there is less
space available.
In fact Unicode specifications do define a lot of stuff about line
breaking and most browsers either implement that or a simplification of
it although as we know they aren't required to.
>> This should work:
>>
>> VeryVeryLongVeryLongword
>
> Should it? By which specification? Beware that HTML specifications do
> not require Unicode conformance or support to particular Unicode
> characters.
I did know that, since you have pointed it out previously. I just meant
"should work" in the sense of "probably will".
|