|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
How to wrap text in <p> tag if the text has no spaces and is very
long? Here is an example: <p>VeryVeryLongVeryVeryLongVeryVeryLongVeryVeryLon gVeryVeryLongVeryVeryLongVeryVeryLongVeryVeryLongV eryVeryLongVeryVeryLongVeryVeryLongVeryVeryLongVer yVeryLongVeryVeryLongVeryVeryLongVeryVeryLongVeryV eryLongVeryVeryLong</ p> The above line is so long that it ought to wrap. But because it has no spaces, it does not wrap. Instead the entire text is really on one line. In Dreamweaver they show you the text going on and on to the right, about 3 screen lengths. But in Firefox, the text past the div boundary (ie. to the right of the boundry) does not show up. Strangely, this google editor they also only do text wrapping if the text has spaces in it. But if no spaces, then you have to scroll to the right to see all of the <p> tag. BTW, I also tried putting the text into <blockquote>. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On 2008-03-29, removeps-groups@yahoo.com <removeps-groups@yahoo.com> wrote:
> How to wrap text in <p> tag if the text has no spaces and is very > long? Here is an example: > ><p>VeryVeryLongVeryVeryLongVeryVeryLongVeryVeryLo ngVeryVeryLongVeryVeryLongVeryVeryLongVeryVeryLong VeryVeryLongVeryVeryLongVeryVeryLongVeryVeryLongVe ryVeryLongVeryVeryLongVeryVeryLongVeryVeryLongVery VeryLongVeryVeryLong</ > p> > > The above line is so long that it ought to wrap. But because it has > no spaces, it does not wrap. Instead the entire text is really on one > line. In Dreamweaver they show you the text going on and on to the > right, about 3 screen lengths. But in Firefox, the text past the div > boundary (ie. to the right of the boundry) does not show up. The only way to make it wrap in browsers is to put zero-width breaking spaces in. This should work: VeryVeryLongVeryLongword Put the characters in wherever you think the browser should break the text. It doesn't make it break there and then (use <br> for that), it just creates a breaking opportunity. An alternative to is the non-standard <wbr> element: VeryVeryLongVery<wbr>Longword It's non-standard but some browsers may support <wbr> that don't support I'm not sure. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Scripsit Ben C:
>><p>VeryVeryLongVeryVeryLongVeryVeryLongVeryVeryL ongVeryVeryLongVeryVeryLongVeryVeryLongVeryVeryLon gVeryVeryLongVeryVeryLongVeryVeryLongVeryVeryLongV eryVeryLongVeryVeryLongVeryVeryLongVeryVeryLongVer yVeryLongVeryVeryLong</ >> p> This first question is: why would anyone write such a monstrosity? 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- > This should work: > > VeryVeryLongVeryLongword Should it? By which specification? Beware that HTML specifications do not require Unicode conformance or support to particular Unicode characters. > It's non-standard but some browsers may support <wbr> that don't > support I'm not sure. I am. The <wbr> markup is far better supported and it is not know to cause any trouble, unlike which may in fact be rendered using a glyph for unsupported characters. More info: http://www.cs.tut.fi/~jkorpela/html/nobr.html#suggest -- Jukka K. Korpela ("Yucca") http://www.cs.tut.fi/~jkorpela/ |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
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". |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
Scripsit Ben C:
>> 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. Then this problem should be fixed instead of trying to make the display of a monstrous URL wrapped. URLs are to be used in attribute values in HTML, not as textual content (except when you _discuss_ URLs as strings, and then you should be competent enough in HTML matters and "URL in context" rules). >> 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. It doesn't define it at all. It would be appropriate to say that _HTML_ doesn't define it exactly (but makes, unline CSS, some vague feeble attempts at making notes that remotely resemble excuses for parts of draft definitions). > 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. Huh, what, where? I don't see such things in CSS specs. The statement "browsers should only ever break lines at line-breaking opportunities" is more or less a truism (line break opportunities are line break opportunities), but I don't think CSS says even that. In CSS 3 drafts, there are attempts at defining properties for line breaking control, but they are incomplete sketches that have made little if any progress during the last few years, and they are neither normative or even proposed normative document nor implemented even experimentally in available browsers, except for some properties. > In fact Unicode specifications do define a lot of stuff about line > breaking Quite a lot indeed, with many oddities. > and most browsers either implement that or a simplification > of it although as we know they aren't required to. I don't think any browser even tries to get close to implementing Unicode line breaking rules or even a simplification of them. Rather, browsers may apply some of those rules, typically in a poor way they were never meant to be used. The rules say that you may break after a hyphen, but it's just stupid to do so in a string like " -x ". -- Jukka K. Korpela ("Yucca") http://www.cs.tut.fi/~jkorpela/ |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
On 03/29/08 03:45 pm, removeps-groups@yahoo.com wrote:
> How to wrap text in <p> tag if the text has no spaces and is very > long? Here is an example: > > <p>VeryVeryLongVeryVeryLongVeryVeryLongVeryVeryLon gVeryVeryLongVeryVeryLongVeryVeryLongVeryVeryLongV eryVeryLongVeryVeryLongVeryVeryLongVeryVeryLongVer yVeryLongVeryVeryLongVeryVeryLongVeryVeryLongVeryV eryLongVeryVeryLong</p> > > The above line is so long that it ought to wrap. But because it has > no spaces, it does not wrap. [...] > Why would it wrap? There are no spaces. Who cares what an editor does? Perhaps if you gave some context for such a ridiculously long line, we could offer a sensible solution. -- jmm (hyphen) list (at) sohnen-moe (dot) com (Remove .AXSPAMGN for email) |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
On Apr 4, 10:50 am, Jim Moe <jmm-list.AXSPA...@sohnen-moe.com> wrote:
> On 03/29/08 03:45 pm,removeps-gro...@yahoo.com wrote:> How to wrap text in <p> tag if the text has no spaces and is very > > The above line is so long that it ought to wrap. But because it has > > no spaces, it does not wrap. [...] > > Why would it wrap? There are no spaces. Who cares what an editor does? > Perhaps if you gave some context for such a ridiculously long line, we > could offer a sensible solution. I'm writing a 404 error page in JSP that says we could not find the URL you entered. It writes out the URL, and unfortunately the URL is longer than the screenwidth and is clipped off. |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
On 04/05/08 10:30 pm, removeps-groups@yahoo.com wrote:
> >> > The above line is so long that it ought to wrap. But because it has >> > no spaces, it does not wrap. [...] >> >> Why would it wrap? There are no spaces. Who cares what an editor does? >> Perhaps if you gave some context for such a ridiculously long line, we >> could offer a sensible solution. > > I'm writing a 404 error page in JSP that says we could not find the > URL you entered. It writes out the URL, and unfortunately the URL is > longer than the screenwidth and is clipped off. Then technically it does not matter whether the URL is valid as displayed. Use a server-side routine to arbitrarily wrap the text however you want it. You could even mention that the bogus URL was wrapped to increase the confusion of the 404 recipient. -- jmm (hyphen) list (at) sohnen-moe (dot) com (Remove .AXSPAMGN for email) |
|
|
|
#9 |
|
Messages: n/a
Hébergeur: |
Scripsit removeps-groups@yahoo.com:
> I'm writing a 404 error page in JSP that says we could not find the > URL you entered. It writes out the URL, and unfortunately the URL is > longer than the screenwidth and is clipped off. Well, why didn't you tell that in your first posting, and why do you _still_ fail to try to find the right group? CSS has nothing to offer you but overflow handling. And why would the URL matter? It's available in the address bar anyway. If you really wish to display it, study the URL specs for "URI in context" and some Style Guide for rules on admissible breaks in URLs "in context", and implement the strategy server-side (assing <wbr> at suitable places and doing something the _prevent_ line breaks after hyphens). There's not very much useful one can say on a 404 error page (most 404 pages concentrate on saying something cryptic if not outright false), but how will the URL benefit the user? -- Jukka K. Korpela ("Yucca") http://www.cs.tut.fi/~jkorpela/ |
|
|
|
#10 |
|
Messages: n/a
Hébergeur: |
On Apr 6, 6:27 am, "Jukka K. Korpela" <jkorp...@cs.tut.fi> wrote:
> Well, why didn't you tell that in your first posting, and why do you > _still_ fail to try to find the right group? CSS has nothing to offer > you but overflow handling. Sorry, maybe I should have said this in the first post. However, the problem (of having enormously long words) could occur in other contexts. Many editors like VI and MSWord do wrap words longer than one line, so I thought CSS might have a property you can set on a div to enable this. Maybe they should add a a property "wrapAt" whose default value is "space" but can be "all". Right now it's as if there is a <wbr> after every space, so with "all" there would be a <wbr> after every character. But you give me an idea -- maybe I can use "overflow:scroll". > And why would the URL matter? It's available in the address bar anyway. No, the address bar will show "http://www.mywebsite.com/errors/ 404.jsp", whereas I want to echo what the user typed. This is just to show them what they typed so that they can see the typo and fix it. Seems more user friendly to me. > If you really wish to display it, study the URL specs for "URI in > context" and some Style Guide for rules on admissible breaks in URLs "in > context", and implement the strategy server-side (assing <wbr> at > suitable places and doing something the _prevent_ line breaks after > hyphens). Thanks, I'll look into this. |
|
|
|
#11 |
|
Messages: n/a
Hébergeur: |
Scripsit removeps-groups@yahoo.com:
> On Apr 6, 6:27 am, "Jukka K. Korpela" <jkorp...@cs.tut.fi> wrote: > >> Well, why didn't you tell that in your first posting, and why do you >> _still_ fail to try to find the right group? CSS has nothing to offer >> you but overflow handling. > > Sorry, maybe I should have said this in the first post. There's really no "maybe" in either of my statements. > However, the > problem (of having enormously long words) could occur in other > contexts. Who cares? Different situations call for different solutions. > Many editors like VI and MSWord do wrap words longer than > one line, Maybe. That has little if anything to do with CSS. > so I thought CSS might have a property you can set on a div > to enable this. Maybe they should add a a property "wrapAt" whose > default value is "space" but can be "all". "Maybe" the situation is far more complicated. IE recognizes a nonstandard CSS property that effectively allows any breaks. It's not useful, because you seldom want to make all breaks allowed and because other browsers won't recognize the property. > Right now it's as if there > is a <wbr> after every space, No, it's more complicated. But why do you care? URLs are not allowed to contain whitespace. > But you give me an idea -- maybe I can use "overflow:scroll". "Maybe" it's a _bad_ idea. I mentioned the CSS feature to emphasize how far from your problem CSS currently is. >> And why would the URL matter? It's available in the address bar >> anyway. > > No, the address bar will show "http://www.mywebsite.com/errors/ > 404.jsp", That's absurd, even if you really own the mywebsite.com domain (which actually exists). The address bar should show the URL requested by the client. Don't mess around with it. It's absurd to break something and then try to construct a plastic imitation, running into endless trouble. To be honest, my 404 error page echoes the URL, and I don't really care if it does not fit into the available width. The user may have to scroll, but why would I set up some _separate_ scrolling mechanism with overflow: scroll (or overflow: auto, which makes much more sense)? -- Jukka K. Korpela ("Yucca") http://www.cs.tut.fi/~jkorpela/ |
|
|
|
#12 |
|
Messages: n/a
Hébergeur: |
dorayme wrote:
> In article <eN8Kj.322215$rR7.99229@reader1.news.saunalahti.fi >, > "Jukka K. Korpela" <jkorpela@cs.tut.fi> wrote: > >> Scripsit removeps-groups@yahoo.com: >> >>> On Apr 6, 6:27 am, "Jukka K. Korpela" <jkorp...@cs.tut.fi> wrote: >>> >>>> Well, why didn't you tell that in your first posting, and why do you >>>> _still_ fail to try to find the right group? CSS has nothing to offer >>>> you but overflow handling. >>> Sorry, maybe I should have said this in the first post. >> There's really no "maybe" in either of my statements. > > No, of course not, you want unconditional surrender, and to humiliate at > every opportunity. You really are quite a bastard! > Thank you. Much more succinct than one of my rants in response to his sometimes egregious behavior. -- Ed Mullen http://edmullen.net Why do they call it the Department of Interior when they are in charge of everything outdoors? |
|
|
|
#13 |
|
Messages: n/a
Hébergeur: |
dorayme wrote:
> In article <d9adnZl-876pOGTanZ2dnUVZ_jCdnZ2d@comcast.com>, > Ed Mullen <ed@edmullen.net> wrote: > >> dorayme wrote: >>> In article <eN8Kj.322215$rR7.99229@reader1.news.saunalahti.fi >, >>> "Jukka K. Korpela" <jkorpela@cs.tut.fi> wrote: >>> >>>> Scripsit removeps-groups@yahoo.com: >>>> >>>>> On Apr 6, 6:27 am, "Jukka K. Korpela" <jkorp...@cs.tut.fi> wrote: >>>>> >>>>>> Well, why didn't you tell that in your first posting, and why do you >>>>>> _still_ fail to try to find the right group? CSS has nothing to offer >>>>>> you but overflow handling. >>>>> Sorry, maybe I should have said this in the first post. >>>> There's really no "maybe" in either of my statements. >>> No, of course not, you want unconditional surrender, and to humiliate at >>> every opportunity. You really are quite a bastard! >>> >> Thank you. Much more succinct than one of my rants in response to his >> sometimes egregious behavior. > > Just a momentary flash of anger at 4.30am. Nothing to worry about. I > still get my coffee and Finnish croissants in his killfile every morning > without fail. This morning he came in with a big grin and "Hello > dorayme, its the bastard with the morning refreshments..." And we had > our usual cordial chat. > I'm glad you have such a cordial relationship with him. I find his attitude and demeanor supercilious and repugnant. Knowledge does not excuse rudeness. Nor does it excuse the purveyor of such from anything including dismissal. That his comments sometimes include knowledge? I don't care. Nor, I understand, does he. So, we are at a stalemate. I ignore him constantly to my possible detriment. And I don't care. I can find his knowledge elsewhere without the cost of his vitriol. Rudeness is never justified. I know, I have been guilty of that sin as well. On the other hand, shit, it's just computer "stuff," eh? Not any life or death issues. So, I shouldn't care, I suppose. But assholes annoy me. Yes, yes, everyone, including I, have one, I know that. I just don't shove mine in peoples' faces every chance I get. He does and that is rude. Sadly, it diminishes his effectiveness and the usefulness of his content. So, he's being counter-productive. Which is just silly given his penchant for dishing out "wisdom." Oh well. -- Ed Mullen http://edmullen.net Does the name Pavlov ring a bell? |
|
|
|
#14 |
|
Messages: n/a
Hébergeur: |
On Apr 6, 11:48 am, dorayme <doraymeRidT...@optusnet.com.au> wrote:
> "Jukka K. Korpela" <jkorp...@cs.tut.fi> wrote: > No, of course not, you want unconditional surrender, and to humiliate at > every opportunity. You really are quite a bastard! Just browsing I found a new properties in CSS 3 "text-wrap" and "word- wrap". http://www.w3.org/TR/css3-text/#text-wrap The word wrap thing works in IE 7, but not Firefox 5or Opera 9.26. <body style="word-wrap:break-word"> LongLongLongLongLongLongLongLongLongLongLongLongLo ngLongLongLongLongLongLongLongLongLongLongLongLong LongLongLongLongLongLongLongLongLongLongLongLongLo ngLongLongLongLongLong </body> </html> BTW, "text-wrap:unrestricted" did not work in IE 7 -- the description of it sounds like it does the same thing as word-wrap:break-word, but I'm probably reading something wrong. This word-wrap is in the MSDN web pages at http://msdn2.microsoft.com/en-us/lib...86(VS.85).aspx, so I guess they support this property of CSS 3. Anyway, this "monstrosity" seems important enough that someone put new properties into CSS 3. |
|
|
|
#15 |
|
Messages: n/a
Hébergeur: |
removeps-groups@yahoo.com wrote:
> On Apr 4, 10:50 am, Jim Moe <jmm-list.AXSPA...@sohnen-moe.com> wrote: >> On 03/29/08 03:45 pm,removeps-gro...@yahoo.com wrote:> How to wrap >> text in <p> tag if the text has no spaces and is very > >>> The above line is so long that it ought to wrap. But because it has >>> no spaces, it does not wrap. [...] >> >> Why would it wrap? There are no spaces. Who cares what an editor >> does? Perhaps if you gave some context for such a ridiculously >> long line, we could offer a sensible solution. > > I'm writing a 404 error page in JSP that says we could not find the > URL you entered. It writes out the URL, and unfortunately the URL is > longer than the screenwidth and is clipped off. Well, you use script to generate it so you can use some like this (betwenn <nobr> and </nobr> it is single line) <nobr>http://domain.com/<wbr>some_very_large_<wbr>text_here/<wbr>and_some_other_<wbr>here</nobr> -- Petr Vileta, Czech republic (My server rejects all messages from Yahoo and Hotmail. Send me your mail from another non-spammer site please.) Please reply to <petr AT practisoft DOT cz> |
|
|
|
#16 |
|
Messages: n/a
Hébergeur: |
Scripsit removeps-groups@yahoo.com:
> On Apr 6, 11:48 am, dorayme <doraymeRidT...@optusnet.com.au> wrote: >> "Jukka K. Korpela" <jkorp...@cs.tut.fi> wrote: > >> No, of course not, you want unconditional surrender, and to >> humiliate at every opportunity. You really are quite a bastard! Do you really want to comment on a person who insults others in public, hiding behind a fake name like a coward? Do you really want to quote his or her rude personal attacks and false accusations? Was it necessary for your purposes? > Just browsing I found a new properties in CSS 3 You might start from checking "CSS caveats". Google for it. > "text-wrap" and "word-wrap". Then consider whether such "free" splitting is adequate for the purpose described in the discussion, namely presenting URLs. Hint 1: Check the recommendations for "URI in context". Hint 2: It surely isn't. -- Jukka K. Korpela ("Yucca") http://www.cs.tut.fi/~jkorpela/ |
|
|
|
#17 |
|
Messages: n/a
Hébergeur: |
On 2008-04-03, Jukka K. Korpela <jkorpela@cs.tut.fi> wrote:
> Scripsit Ben C: [...] >> In fact Unicode specifications do define a lot of stuff about line >> breaking > > Quite a lot indeed, with many oddities. > >> and most browsers either implement that or a simplification >> of it although as we know they aren't required to. > > I don't think any browser even tries to get close to implementing > Unicode line breaking rules or even a simplification of them. If you're writing a browser that has to display text in a variety of different scripts used for languages you aren't familiar with yourself, it's much easier to load in the Unicode breaking class tables and use the Unicode specification than it is to learn all those scripts and their different conventions. |
|
|
|
#18 |
|
Messages: n/a
Hébergeur: |
Scripsit Ben C:
>> I don't think any browser even tries to get close to implementing >> Unicode line breaking rules or even a simplification of them. > > If you're writing a browser that has to display text in a variety of > different scripts used for languages you aren't familiar with > yourself, it's much easier to load in the Unicode breaking class > tables and use the Unicode specification than it is to learn all > those scripts and their different conventions. Quite right, so it's somewhat surprising that browsers don't do that. One reason to this might be that Unicode line breaking rules haven't been stable. Moreover, they are fairly complex. (And applying them indiscriminately leads to poor results, like breaking after "-" even in a context like "the temperature is -8 degrees".) -- Jukka K. Korpela ("Yucca") http://www.cs.tut.fi/~jkorpela/ |
|
|
|
#19 |
|
Messages: n/a
Hébergeur: |
On Wed, 9 Apr 2008, Jukka K. Korpela wrote:
> (And applying them indiscriminately leads to poor results, > like breaking after "-" even in a context like > "the temperature is -8 degrees".) If you did not use a minus sign U+2212 here, you deserve it to be punished. -- In memoriam Alan J. Flavell http://groups.google.com/groups/sear...Alan.J.Flavell |
|
|
|
#20 |
|
Messages: n/a
Hébergeur: |
Scripsit Andreas Prilop:
> On Wed, 9 Apr 2008, Jukka K. Korpela wrote: > >> (And applying them indiscriminately leads to poor results, >> like breaking after "-" even in a context like >> "the temperature is -8 degrees".) > > If you did not use a minus sign U+2212 here, you deserve it > to be punished. Much more than half of the world uses hyphen-minus in the function of minus sign, so the browser behavior is wrong for this reason, too. Moreover, the breaking problem also applies to things like "The constant EOF is defined as (-1)", where it would be quite inappropriate to use a minus sign, even though the expression refers to a negative number. -- Jukka K. Korpela ("Yucca") http://www.cs.tut.fi/~jkorpela/ |
|
![]() |
| Outils de la discussion | |
|
|