Your Ad Here

Posted By

JimSangwine on 05/05/11


Tagged


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

madebylam
spee66


Make “Pre” Text Wrap


 / Published in: CSS
 

  1. /* Text in <pre> tags doesn't wrap by default. For example, see the code snippet below! If this is causing layout problems, one solution is to give the pre block an overflow property to hide the excess or cause it to scroll. The other solution is to have it wrap. */
  2.  
  3. /* Browser specific (not valid) styles to make preformatted text wrap */
  4.  
  5. pre {
  6. white-space: pre-wrap; /* css-3 */
  7. white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
  8. white-space: -pre-wrap; /* Opera 4-6 */
  9. white-space: -o-pre-wrap; /* Opera 7 */
  10. word-wrap: break-word; /* Internet Explorer 5.5+ */
  11. }

Report this snippet  

You need to login to post a comment.