Twitter Updates

Monday, 7 December 2009

201st Post: Finally fixed wrapping text in pre tags

pre tags are used in html to maintain the display of whitespace as it is written in the html. This lends itself nicely to code snippets but unfortunately means that it does not wrap text nicely by default.

By adding this [1] to the embedded or external style sheets you can get text to behave nicely inside pre tags.

pre {
white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* Internet Explorer 5.5+ */

Original source:

No comments: