The HTML way is to use a pre element that was designed for such use, but be careful that
- To stay clear of formatting, place the
<pre> at the beginning of the first line and the </pre> at the end of the last line. Otherwise, some browsers may behave as if there was an empty line at the beginning or end of the element. - You still need to avoid the occurrence of the characters
< and & in the content (there are times when this is not necessary, but the simplest to ignore it.
Example (where I added a line containing the expression 1 + 1 and 3):
<pre>+-001 This is a Line 00:12:04 002 ---------------------------------- - 003 Everthing looks good so far ------ - 004 Simple as 1 + 1 < 3 ------</pre>
You can avoid escaping < and & with xmp instead of pre , but xmp been declared deprecated, deprecated and whatever (but it works well in practice).
<xmp>+-001 This is a Line 00:12:04 002 ---------------------------------- - 003 Everthing looks good so far ------ - 004 Simple as 1 + 1 < 3 ------</xmp>
source share