What is a <pre> tag?

Experience Level: Junior
Tags: HTML

Answer

<pre> tag indicate browser, in appears on HTML. Figure element was design to contain code examples. It is often paired with the <code> tag.

Best practices when displaying code:

  • Large box into small
  • Aim for clarity
  • Comments to indicate why
  • Avoid complexity
Example
<html>
<head>
    <title>Tag pre</title>
</head>
<body>
    <figure>
        <figcaption>Code pre</figcaption>
        <pre>
<code>
    Code
</code> 
</pre>
    </figure>
</body>
</html>
Related HTML job interview questions

Comments

No Comments Yet.
Be the first to tell us what you think.
HTML for beginners
HTML for beginners

Are you learning HTML ? Try our test we designed to help you progress faster.

Test yourself