How to make <pre> tags wrap

Especially when using a responsive site design, you will probably encounter a need to display some text usign a fixed-width font but with word wrap so you don’t get excessively long lines on small displays. Here’s the way to do it:

pre {
    display: inline-block;
    white-space: pre-wrap;
}

Leave a Reply

Your email address will not be published. Required fields are marked *