Preserving indentation in the <pre>
One typically indents HTML code when writing it to visualize the hierarchy of nested elements and for the sake of organization.
|
|
However, with <pre>
tags, this indented whitespace is preserved in the displayed text:
|
From the bells, bells, bells, bells, Bells, bells, bells—- Edgar Allan Poe |
A typical solution is to sacrifice hierarchy by removing the indentation from the content of the <pre>
.
|
From the bells, bells, bells, bells, Bells, bells, bells—- Edgar Allan Poe |
Better solution: the CSS property white-space: pre-line
:
|
From the bells, bells, bells, bells, Bells, bells, bells—- Edgar Allan Poe |