Wrap lines within PRE tagged text

Added by David McRitchie@userstyles, Created: Jul 16, 2009, Updated: Jul 17, 2009
  • With the style applied (Generated screenshot)
  • Without the style applied (Generated screenshot)

Description:

The primary use of the
 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
 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 http://freestyler.ws/style/15047/wrap-pre-text-http-and-https-only (19596).

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 http://freestyler.ws/style/15046/wrap-lines-within-pre-tagged-text
(None)

Installs:
Applies to:
all URLs

Related styles:

WARNING: This webware is not functioning properly. Please enable javascript in your browser and try again.