<code>



HTML <code> Tag


The <code> tag is used to mention a specific text is a computer code.

During website development, It is mandatory to show the Output result, error message, or coding part to a user on a webpage.


Syntax :

<code> Computer Code </code>

Example :

<!DOCTYPE html>
<html>
  <head>
    <head>
      <meta name="viewport" content="width=device-width, initial-scale=1.0" />
      <title>HTML Computer code</title>
    </head>
  </head>
  <body>
    <h2>Computer Code</h2>
    <p>Programming code:</p>
    <code>
      x = 30;<br />
      y = 20;<br />
      z = x + y;
    </code>
  </body>
</html>

Output :