HTML Computer Code Elements
HTML contains several elements for defining user input and computer code.
Example
<code>
x = 5;
y = 6;
z = x + y;
</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.
Example
Define some text as keyboard input in a document:
<p>Save the document by pressing <kbd>Ctrl + S</kbd></p>Result:
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.
Example
Define some text as sample output from a computer program in a document:
<p>Message from my computer:</p>
<p><samp>File not found.<br>Press F1 to continue</samp></p>Result:
Message from my computer:
File not found.
Press F1 to continue
Leave a comment
Your email address will not be published. Required fields are marked *