Is forcing wrapping needed at all? You can't even know the font size I use. Inserting spaces, even when at better offsets, will always be a suboptimal and lossy solution.

You can save yourself the trouble by putting each chatterbox line in a <div> that has, via CSS, overflow set to auto. Then every line that has a word in it that cannot be wrapped by the browser gets its own nice horizontal scrollbar, but only for the part that needs it. There already are <span> tags now (WHY? span+br is a red flag! Oh, and <span class="chat"><span class="chatfrom_221638"> should probably just be <span class="chat chatfrom_221638">), and those can be made <div>s, so it'll actually save some bandwidth ;)

DIV.chat { overflow: auto; } is all it takes, and lets you get rid of the ugly space insertion hacks of dozens of lines. Off-site example (that will be removed soon) can be found at http://juerd.nl/pmchattertest.html.

Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }


In reply to Re: A call to keyboards: Better chatterbox wrapping by Juerd
in thread A call to keyboards: Better chatterbox wrapping by demerphq

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.