Smal SEO Tool

HTML Computer Code Elements

HTML contains several elements for defining user input and computer code.

The <code> Element

The <code> element defines a piece of computer code. The content inside is displayed in the browser's default monospace font.

html
<p>The HTML <code>button</code> tag defines a clickable button.</p>
Try it Yourself »

The <kbd> Element for Keyboard Input

The <kbd> element defines keyboard input. The content inside is displayed in the browser's default monospace font.

html
<p>Save the document by pressing <kbd>Ctrl + S</kbd>.</p>
Try it Yourself »

The <samp> Element for Program Output

The <samp> element defines sample output from a computer program.

html
<samp>File not found.<br>Press F1 to continue</samp>
Try it Yourself »

The <var> Element for Variables

The <var> element defines a variable in a programming expression or a mathematical equation. The content inside is typically displayed in italic.

html
<p>The area of a triangle is: 1/2 x <var>b</var> x <var>h</var>, where <var>b</var> is the base, and <var>h</var> is the vertical height.</p>
Try it Yourself »

Test Yourself with an Exercise

Which HTML element is used to define keyboard input?