Why use HTML <'pre'> Element

In HTML, spaces and new lines are ignored:

[html]<p>

My Bonnie lies over the ocean.

My Bonnie lies over the sea.

My Bonnie lies over the ocean.

Oh, bring back my Bonnie to me.

</p>[/html]

Display in your Browser:
My Bonnie lies over the ocean. My Bonnie lies over the sea. My Bonnie lies over the ocean. Oh, bring back my Bonnie to me.

Solution: The HTML <pre> Element

The pre tag preserves both spaces and line breaks:

[html]<pre>
My Bonnie lies over the ocean.

My Bonnie lies over the sea.

My Bonnie lies over the ocean.

Oh, bring back my Bonnie to me.
</pre>[/html]

Display in your Browser:

My Bonnie lies over the ocean.

My Bonnie lies over the sea.

My Bonnie lies over the ocean.
   
Oh, bring back my Bonnie to me.

Leave a Comment