HTML COMPUTER CODE
There are few tags in HTML which let us represent computer codes, programs or outputs on the webpage. Since computer codes are different from simple texts so these tags are used to differentiate between simple text and computer codes.
The HTML tags that are used for these purposes are as follows:
1). HTML code tag
Sometimes we need to show computer code or programs on the screen which could be done by another tag also but we have a special tag for this purpose <code>.
The <code> is used to display computer codes on the webpage.
<code> ...computer codes... </code>
The <code> tag contents are displayed by fixed width,spacing and font-size.
var a = 10; var b = 12; var c = a + b; console.log(c);
2). HTML kbd tag
The kbd is used to display keyboard inputs.
The kbd tag is generally monospaced.
This tag has no specific attribute.
<kbd> ...keyboard input... </kbd>
The <kbd> tag can be given a better look using CSS.
ctrl a; ctrl c; ctrl v;
3). HTML samp tag
The samp is used to display computer output or any kind of result or error.
The samp tag display content monospaced.
<samp> ...contents... </samp>
error successful run time error
4). HTML var tag
The var is used to define any variable in mathematics or in computers.
<var> ...contents... </var>
It can be given CSS properties for better look.
And god said: f = m*a E = MC2