userstyles.org - Wrap lines within PRE tagged text

(No screenshot available)
Author David McRitchie
Created Jul 17, 2009
Updated Jul 18, 2009
Installs (this week) 2
Installs (total) 679
The primary use of the <PRE> tag in HTML is to display code or other material where the character and line spacing is wanted as written with a fixed font (non-proportional) and will not flow from one line to another. Sometimes there is not enough space to properly display text and it will fall off of the edge of the page or overlap with something to the right. There is a special white-space attribute to handle this ("pre-wrap") but it is not the default by any means.

Wrap long lines in <PRE> tags with
PRE {white-space: pre-wrap !important;}

If you always want to do this you can put the above code into your userChrome.css

A variant is Wrap PRE text (http and https only) (19596).
To use this style, install Firefox and Stylish.
Wrap lines within PRE tagged text
12592
19595

More Info

If you want the ability to toggle line wrapping on and off easier than through Stylish, there is an extension "Toggle Word Wrap"; however, the keyboard shortcut Ctrl+Shift+O conflicts with that of the "Open Long URL" extension, which can be resolved with the "keyconfig" extension.

Additional Infomation:
Paragraphs, Lines, and Phrases
9.3.4 Preformatted text: The PRE element
http://www.w3.org/TR/REC-html40/struct/text.html#edef-PRE

16.6 White space: the 'white-space' property
http://www.w3.org/TR/CSS2/text.html#white-space-prop

Some background:
Bug 261081 – Add support for pre-wrap value of white-space, RESOLVED FIXED
Bug 433065 – remove support for -moz-pre-wrap, RESOLVED FIXED

Updates: since 2009-07-17 installed as Wrap lines within PRE tagged text
(None)

Feedback

Discussions

No discussions posted yet. Be the first to ask a question or review this style.