HTML - Computer codes

<kbd> element:

The <kbd> element represents user input or keyboard input.

It is commonly used to display keyboard keys or key combinations.

<kbd>Ctrl</kbd> + <kbd>C</kbd>

<samp> element:

The <samp> element represents sample output or sample computer code output.

It is often used to display the result or output of a computer program.

<samp>Error: File not found</samp>

<var> element:

The <var> element represents a variable or placeholder in computer code or mathematics.

It is typically used to highlight variable names or placeholders within a text.

<var>x</var> = 5

<pre> element:

The <pre> element represents preformatted text.

It preserves whitespace and line breaks and is commonly used to display code blocks or ASCII art.

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

<code> element:

The <code> element represents a fragment of computer code.

It is used to enclose a piece of code within a paragraph or other textual content.

<p>To display a message in JavaScript, use the <code>console.log()</code> function.</p>

These elements are used to provide specific semantics and formatting to different types of content within an HTML document. They can be combined with CSS to style them according to your design requirements.