Skip to content
techsnow

HTML Basic Tags

Pre Tag

The <pre> tag shows preformatted text. Unlike a paragraph, it keeps every space and line break exactly as you typed it, and uses a monospace font where every character has the same width.

Syntax:

<pre>
  Name      Marks   Grade
  Ali       85      A
  Sara      92      A+
</pre>

Output

  Name      Marks   Grade
  Ali       85      A
  Sara      92      A+

Showing code

Combine <pre> with <code> to show a block of code. This is the standard way to display code on a web page.

<pre><code>function greet() {
  console.log("Hello!");
}</code></pre>