HTML Code Elements


HTML contains several elements for defining user input and code.



HTML <kbd> for Keyboard Input

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

The example below shows how to define text as keyboard input in a HTML document.


HTML <samp> for Program Output

The HTML <samp> element is used to define sample output from a computer program. The content inside is displayed in the browser's default monospace font.

The example below shows how to define sample output from a computer program in a HTML document:


HTML <code> for Code

The HTMl <code> element is used to define a piece of code. The content inside is displayed in the browser's default monospace font.

The example below shows how to define text as computer code in a HTML document: