How to wrap text in <p> tag if the text has no spaces and is verylong

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • removeps-groups@yahoo.com

    How to wrap text in <p> tag if the text has no spaces and is verylong

    How to wrap text in <ptag if the text has no spaces and is very
    long? Here is an example:

    <p>VeryVeryLong VeryVeryLongVer yVeryLongVeryVe ryLongVeryVeryL ongVeryVeryLong VeryVeryLongVer yVeryLongVeryVe ryLongVeryVeryL ongVeryVeryLong VeryVeryLongVer yVeryLongVeryVe ryLongVeryVeryL ongVeryVeryLong VeryVeryLongVer yVeryLong</
    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 <ptag.

    BTW, I also tried putting the text into <blockquote>.
  • Ben C

    #2
    Re: How to wrap text in &lt;p&gt; tag if the text has no spaces and is very long

    On 2008-03-29, removeps-groups@yahoo.co m <removeps-groups@yahoo.co mwrote:
    How to wrap text in <ptag if the text has no spaces and is very
    long? Here is an example:
    >
    ><p>VeryVeryLon gVeryVeryLongVe ryVeryLongVeryV eryLongVeryVery LongVeryVeryLon gVeryVeryLongVe ryVeryLongVeryV eryLongVeryVery LongVeryVeryLon gVeryVeryLongVe ryVeryLongVeryV eryLongVeryVery LongVeryVeryLon gVeryVeryLongVe ryVeryLong</
    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:

    VeryVeryLongVer y​Longword

    Put the ​ characters in wherever you think the browser should
    break the text. It doesn't make it break there and then (use <brfor
    that), it just creates a breaking opportunity.

    An alternative to ​ is the non-standard <wbrelement:

    VeryVeryLongVer y<wbr>Longword

    It's non-standard but some browsers may support <wbrthat don't support
    ​ I'm not sure.

    Comment

    • dorayme

      #3
      Re: How to wrap text in &lt;p&gt; tag if the text has no spaces and is very long

      In article <slrnfutir6.hgt .spamspam@bowse r.marioworld>,
      Ben C <spamspam@spam. eggswrote:
      On 2008-03-29, removeps-groups@yahoo.co m <removeps-groups@yahoo.co mwrote:
      How to wrap text in <ptag if the text has no spaces and is very
      long? Here is an example:

      <p>VeryVeryLong VeryVeryLongVer yVeryLongVeryVe ryLongVeryVeryL ongVeryVeryLong Ve
      ryVeryLongVeryV eryLongVeryVery LongVeryVeryLon gVeryVeryLongVe ryVeryLongVeryV er
      yLongVeryVeryLo ngVeryVeryLongV eryVeryLongVery VeryLongVeryVer yLong</
      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:
      >
      VeryVeryLongVer y​Longword
      >
      Put the ​ characters in wherever you think the browser should
      break the text. It doesn't make it break there and then (use <brfor
      that), it just creates a breaking opportunity.
      >
      An alternative to ​ is the non-standard <wbrelement:
      >
      VeryVeryLongVer y<wbr>Longword
      >
      It's non-standard but some browsers may support <wbrthat don't support
      ​ I'm not sure.
      There is a table of what browsers do with wbr, ​, and ­ at:
      <http://www.quirksmode. org/oddsandends/wbr.html>

      --
      dorayme

      Comment

      • Jukka K. Korpela

        #4
        Re: How to wrap text in &lt;p&gt; tag if the text has no spaces and is very long

        Scripsit Ben C:
        >><p>VeryVeryLo ngVeryVeryLongV eryVeryLongVery VeryLongVeryVer yLongVeryVeryLo ngVeryVeryLongV eryVeryLongVery VeryLongVeryVer yLongVeryVeryLo ngVeryVeryLongV eryVeryLongVery VeryLongVeryVer yLongVeryVeryLo ngVeryVeryLongV eryVeryLong</
        >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:
        >
        VeryVeryLongVer y​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 <wbrthat don't
        support ​ I'm not sure.
        I am. The <wbrmarkup 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")


        Comment

        • Ben C

          #5
          Re: How to wrap text in &lt;p&gt; tag if the text has no spaces and is very long

          On 2008-03-30, Jukka K. Korpela <jkorpela@cs.tu t.fiwrote:
          Scripsit Ben C:
          >
          >>><p>VeryVeryL ongVeryVeryLong VeryVeryLongVer yVeryLongVeryVe ryLongVeryVeryL ongVeryVeryLong VeryVeryLongVer yVeryLongVeryVe ryLongVeryVeryL ongVeryVeryLong VeryVeryLongVer yVeryLongVeryVe ryLongVeryVeryL ongVeryVeryLong VeryVeryLong</
          >>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:
          >>
          > VeryVeryLongVer y​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".

          Comment

          • Jim Moe

            #6
            Re: How to wrap text in &lt;p&gt; tag if the text has no spaces and isvery long

            On 03/29/08 03:45 pm, removeps-groups@yahoo.co m wrote:
            How to wrap text in <ptag if the text has no spaces and is very
            long? Here is an example:
            >
            <p>VeryVeryLong VeryVeryLongVer yVeryLongVeryVe ryLongVeryVeryL ongVeryVeryLong VeryVeryLongVer yVeryLongVeryVe ryLongVeryVeryL ongVeryVeryLong VeryVeryLongVer yVeryLongVeryVe ryLongVeryVeryL ongVeryVeryLong VeryVeryLongVer yVeryLong</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)

            Comment

            • removeps-groups@yahoo.com

              #7
              Re: How to wrap text in &lt;p&gt; tag if the text has no spaces and is verylong

              On Apr 4, 10:50 am, Jim Moe <jmm-list.AXSPA...@s ohnen-moe.comwrote:
              On 03/29/08 03:45 pm,removeps-gro...@yahoo.co m wrote:How to wrap text in <ptag 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.

              Comment

              • Jim Moe

                #8
                Re: How to wrap text in &lt;p&gt; tag if the text has no spaces and isvery long

                On 04/05/08 10:30 pm, removeps-groups@yahoo.co m 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)

                Comment

                • Jukka K. Korpela

                  #9
                  Re: How to wrap text in &lt;p&gt; tag if the text has no spaces and is very long

                  Scripsit removeps-groups@yahoo.co m:
                  On Apr 6, 6:27 am, "Jukka K. Korpela" <jkorp...@cs.tu t.fiwrote:
                  >
                  >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 <wbrafter 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:scrol l".
                  "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.c om/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")


                  Comment

                  • Petr Vileta

                    #10
                    Re: How to wrap text in &lt;p&gt; tag if the text has no spaces and is very long

                    removeps-groups@yahoo.co m wrote:
                    On Apr 4, 10:50 am, Jim Moe <jmm-list.AXSPA...@s ohnen-moe.comwrote:
                    >On 03/29/08 03:45 pm,removeps-gro...@yahoo.co m wrote:How to wrap
                    >text in <ptag 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 <nobrand </nobrit is single line)

                    <nobr>http://domain.com/<wbr>some_very_ large_<wbr>text _here/<wbr>and_some_o ther_<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>

                    Comment

                    • Andreas Prilop

                      #11
                      Re: How to wrap text in &lt;p&gt; tag if the text has no spaces and isvery long

                      On Wed, 9 Apr 2008, Jukka K. Korpela wrote:
                      (And applying them indiscriminatel y 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

                      Comment

                      • Jukka K. Korpela

                        #12
                        Re: How to wrap text in &lt;p&gt; tag if the text has no spaces and is very long

                        Scripsit Andreas Prilop:
                        On Wed, 9 Apr 2008, Jukka K. Korpela wrote:
                        >
                        >(And applying them indiscriminatel y 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")


                        Comment

                        • Ben C

                          #13
                          Re: How to wrap text in &lt;p&gt; tag if the text has no spaces and is very long

                          On 2008-04-03, Jukka K. Korpela <jkorpela@cs.tu t.fiwrote:
                          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.

                          Comment

                          • Jukka K. Korpela

                            #14
                            Re: How to wrap text in &lt;p&gt; tag if the text has no spaces and is very long

                            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
                            indiscriminatel y leads to poor results, like breaking after "-" even in
                            a context like "the temperature is -8 degrees".)

                            --
                            Jukka K. Korpela ("Yucca")


                            Comment

                            • Andreas Prilop

                              #15
                              Re: How to wrap text in &lt;p&gt; tag if the text has no spaces and isvery long

                              On Wed, 9 Apr 2008, Jukka K. Korpela wrote:
                              (And applying them indiscriminatel y 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

                              Comment

                              Working...