html <pre> code example

Example 1: html pre tag

The <pre> tag defines preformatted text.

Text in a <pre> element is displayed in a fixed-width font (usually Courier), and it preserves both spaces and line breaks.

Example:
<pre>
Hello greppers,    ankur
here hope you   all
are enjoying        the 
coding.
</pre>

Example 2: element in 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>

Example 3: adding pre tag javascript

<Card>
  <CardHeader title="Output" />
  <CardContent>
    <pre style={{ backgroundColor: "white" }}>{JSON.stringify(values, null, 2)}</pre>
  </CardContent>
</Card>

Tags:

Html Example