HTML · HTML Tutorial · Lesson 31
HTML Computercode
Keyboard input, program output, code and variables.
HTML contains elements for defining user input and computer code.
Example
<p>Save the document by pressing <kbd>Ctrl</kbd> + <kbd>S</kbd></p>
<p>Message from my computer:</p>
<p><samp>File not found.<br>Press F1 to continue</samp></p>
<code>x = 5;
y = 6;</code>
<p>The area of a triangle is: 1/2 x <var>b</var> x <var>h</var></p>
| Tag | Description |
|---|---|
| <code> | A piece of computer code |
| <kbd> | Keyboard input |
| <samp> | Sample output from a program |
| <var> | A variable |
| <pre> | Preformatted text |
Preserve formatting
Keep reading “HTML Computercode”
Sign up to read the full lesson (1 more parts), try every example in the live editor, and take the 5-question quiz.