<pre>

Browser
  • IE
  • Cr
  • Sf
  • Fx
  • O
Type

The PRE element defines preformatted text.


<pre>preformatted text</pre>

The text within the PRE element is displayed in fixed-width font. It also preserves spaces and line breaks.

This element is commonly used to display program code.

Example


<p>The text enclosed in the PRE element.</p>
<pre>
function PopTag() { 

	if (!document.getElementById) {

		alert("Hello");
		return;

	}

}
</pre>

<p>The text not enclosed in the PRE element.</p>
function PopTag() { 

	if (!document.getElementById) {

		alert("Hello");
		return;

	}

}

Output

The text enclosed in the PRE element.

function PopTag() { 

	if (!document.getElementById) {

		alert("Hello");
		return;

	}

}

The text not enclosed in the PRE element.

function PopTag() { if (!document.getElementById) { alert("Hello"); return; } }