<pre> tags to define preformatted text, a common application is used to represent the source code of the computer. Text that is surrounded in the pre element usually retains spaces and line breaks, but unfortunately, when you write code in the <pre> tag, if you do not wrap the line manually, it will also keep it for you, rather than wrapping it automatically.
At this time, you can use Overflow:auto; (The scroll box is displayed when the code is out of bounds of the container), but this method does not apply to all major browsers, and some browsers directly truncate the excess content.
Solution.
Pre {
White-space:pre-wrap; * css-3 * *
White-space:-moz-pre-wrap; * 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+ * *
}
The CSS scheme allows text to be wrapped in the pre label, and is tested on the browser, all supported, Ie6,ie7, IE8, Firefox, Opera, Safari and Chrome.
Only when you narrow the window to a width of less than 20 characters will the boundary be exceeded.