HTML Tutorial
HTML Forms
HTML Graphics
HTML Media
HTML API
HTML Computer Code Elements
HTML consists of several elements for defining user input and computer code.
Example
Computer Code
Some programming code:
x = 5;
y = 6;
z = x + y;
Output:
Computer Code
Some programming code:
x = 5;
y = 6;
z = x + y;
HTML <var> For Variables
The HTML <var> element defines a variable in programming or in a mathematical expression. The content within is typically showed in italic.
Example
The area of a triangle is: 1/2 x b x h, where b is the base, and h is the vertical height.
Output:
The area of a triangle is: 1/2 x b x h, where b is the base, and h is the vertical height.
HTML <kbd> For Keyboard Input
The HTML <kbd> element defines the keyboard input. The content within is showed in the browser’s default monospace font.
Example
The kbd element is used to define keyboard input:
Save the document by pressing Ctrl + S
Output:
The kbd element is used to define keyboard input:
Save the document by pressing Ctrl + S
HTML <samp> For Program Output
The HTML <samp> element defines sample output from a computer program.
Example
Message from my computer:
File not found.
Press F1 to continue
Output:
Message from my computer:
File not found.
Press F1 to continue