PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.info.authoring.CSS > How to wrap text in <p> tag if the text has no spaces and is verylong
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
How to wrap text in <p> tag if the text has no spaces and is verylong

Réponse
 
LinkBack Outils de la discussion
Vieux 29/03/2008, 23h45   #1
removeps-groups@yahoo.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut How to wrap text in <p> tag if the text has no spaces and is verylong

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>.
  Réponse avec citation
Vieux 30/03/2008, 00h05   #2
Ben C
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to wrap text in <p> tag if the text has no spaces and is very long

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:

VeryVeryLongVery​Longword

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.
  Réponse avec citation
Vieux 30/03/2008, 19h03   #3
Jukka K. Korpela
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to wrap text in <p> tag if the text has no spaces and is very long

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:
>
> VeryVeryLongVery​Longword


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/

  Réponse avec citation
Vieux 30/03/2008, 19h59   #4
Ben C
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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:
>>
>> VeryVeryLongVery​Longword

>
> 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".
  Réponse avec citation
Vieux 03/04/2008, 20h46   #5
Jukka K. Korpela
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to wrap text in <p> tag if the text has no spaces and is very long

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/

  Réponse avec citation
Vieux 04/04/2008, 18h50   #6
Jim Moe
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to wrap text in <p> tag if the text has no spaces and isvery long

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)
  Réponse avec citation
Vieux 06/04/2008, 06h30   #7
removeps-groups@yahoo.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to wrap text in <p> tag if the text has no spaces and is verylong

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.
  Réponse avec citation
Vieux 06/04/2008, 07h44   #8
Jim Moe
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to wrap text in <p> tag if the text has no spaces and isvery long

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)
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 13h57.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,17060 seconds with 16 queries