Wordwrap That PRE!


Ever used a <PRE> in a limited width div container? You will notice that the line gets cut off almost as if word-wrap was not enabled.

To correct this you can add the following code into your CSS file.

pre{
  white-space: pre-wrap; /* CSS2.1 compliant */
  white-space: -moz-pre-wrap; /* Mozilla-based browsers */
  white-space: o-pre-wrap; /* Opera 7+ */
}

This code was originally found somewhere else online but I found it really useful so reposted it!
If you’re the original author then comment and let us know 🙂

P.S. Thanks 😉