The pre element defines preformatted text. Text surrounded by pre elements usually retains spaces and line breaks. The text will also be presented in monospace fonts.
A common application of <pre> tags is to represent the source code of a computer. For technical blogs, pre tag output code or code highlighting is often used. By default, if the content in pre tag is out of range, it will not be automatically wrapped.
The following is a method to make the content in the <pre> tag automatically wrap and comply with W3C standards (multi-browser support)
Copy the code