Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

<pre> tags on wide lines

by tod222 (Pilgrim)
on Nov 20, 2010 at 23:33 UTC ( #872718=monkdiscuss: print w/replies, xml ) Need Help??

The node Need to turn off prints from module was approved and then Front-paged despite having a wide line inside a <pre> tag.

In the section Tags You Should NOT Use, Markup in the Monastery says:

At first blush, the <pre> ...</pre pair may look like an alternative to code tags... BUT DON'T USE IT HERE chiefly because <pre>...</pre> tags will not wrap lines that are too long for the viewer's browser window.

In the past several months it's been a common occurrence to see the front page layout messed up by a wide line inside a <pre> tag in a node that's been approved and Front-paged. By comparison, this happened rarely a couple of years ago due to better moderation. I recall logging in and finding a private message about needing to fix up a wide <pre> line in one of my nodes.

<pre> tags have been discussed previously in <pre> vs. <code> tags.

Replies are listed 'Best First'.
Re: <pre> tags on wide lines
by Anonymous Monk on Nov 21, 2010 at 02:42 UTC
    It could be solved for modern browsers by adding pre { white-space: pre-wrap; } to the site's stylesheet.

    See the CSS2 specification for how it's supposed to work, and Quirksmode for browser support and test cases.


      This rule is now used in the common.css file and thus PRE tags should now wrap nicer.

      Awesome! That fixed things nicely for me. I'm certain the gang playing with style sheets for a site facelift will want to add this to the default.


Re: <pre> tags on wide lines
by kcott (Bishop) on Nov 21, 2010 at 19:25 UTC

    I agree there have been a number of poorly formatted (and even unformatted) nodes that have been Front-paged: this, of course, reflects poorly on the site in general.

    Looking at the responses regarding CSS, it's quite possible that moderators using such CSS rules where unaware of the problem. This presents something of a dilemma.

    One solution might be to add alerts to the Approval Nodelet. One such alert could perhaps be a standard reminder, e.g. Don't front-page unformatted nodes.; another could be conditional such as This node contains <pre> tag(s) - check before front-paging!.

    This sort of change would require:

    1. Discussion and consensus.
    2. A volunteer to do the work. I'd be happy to take on the task but would seek guidance on what groups I need to join (e.g. pmdev) and other prerequisites (e.g. setting up a test environment).

    -- Ken

Re: <pre> tags on wide lines
by roho (Chancellor) on Nov 26, 2010 at 15:32 UTC
    The top part of PM pages now displays as shown below (right justified against right margin) using IE8. What's even more odd, it still displays normally using Firefox. Is this caused by the CSS mod? If so, how can it be undone?

       The Monastery Gates 
              Super Search 
    Seekers of Perl Wisdom 
      PerlMonks Discussion 
        Cool Uses For Perl 
                 Perl News 
            Recent Threads 
              Newest Nodes 
                What's New 

    "Its not how hard you work, its how much you get done."

      Well, I have seen this behavior on IE8 as well, however, it only seems to be happening on nodes with long Title Lines, on short titles (4 words or less), it displays normally.

      I'm not sure if it is because of CSS, or because of a code change, as perlmonks is maintained by a few dedicated monks who sometimes work late into the night.

      I'm sure if you dropped a /msg to the Gods, referencing this node, they would look at it.



      "No trees were harmed in the creation of this node. However, a rather large number of electrons were somewhat inconvenienced."

        I'm sure if you dropped a /msg to the Gods, referencing this node, they would look at it.

        Um, no, actually, this is more of a pmdev concern — they broke it; they should fix it.

        But the best course of action is to post a public PMD, just as the OP has done.

        BTW... Does the problem persist? It's been a while, and some changes have been made.


        What is the sound of Windows? Is it not the sound of a wall upon which people have smashed their heads... all the way through?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: monkdiscuss [id://872718]
Approved by GrandFather
Front-paged by tye
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2020-10-29 18:06 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (274 votes). Check out past polls.