HTML Computer Code Elements

HTML Computer Code Elements

 

 HTML Computer Code Formatting

HTML uses variable letter size and letter spacing. This is not needed in case of displaying computer codes in web pages. For that html provides  tags such as <kbd>,<samp> and <code>. This tags support fixed letter size and spacing.

HTML Keyboard Formating

<kbd> Element  is used to identify keystrokes that the users must make. It is normally  found in online technical manuals. This tag gives special font to Keys that user need to press. Most browsers show <kbd> Element in monospace font.  
<p>Please Press <kbd>CTRL</kbd>,<kbd>ALT</kbd> and <kbd>DELETE</kbd></p>

HTML Sample Formatting

Sample tag is used to represent  sample output from a computer program. It is used in online tutorials to include sample outputs from computer.Given below is an example.
<p>Here is the out put of the program <samp> Hello World</samp></p>

HTML Code Formatting

Code Element in html is used to include programming codes into a website. By default, it is displayed in the browser's default monospace font.
<p>Here is a  Code <code> this is a code</code></p>
Code element does not preserve extra space and line breaks.So we need to use <pre> tag.

HTML Variable Formatting

It is used to add mathematical variables into the page.
<p><var>E = m c<sup>2</sup></var></p>
<html>
<head>
</head>
<body>
</body>
<p>Please Press <kbd>CTRL</kbd>,<kbd>ALT</kbd> and <kbd>DELETE</kbd></p>
<p>Here is the out put of the program <samp> Hello World</samp></p>
<code>
var person = { firstName:"John", lastName:"Doe", age:50, eyeColor:"blue" } </code>
<p><var>E = m c<sup>2</sup></var></p>
</html>

Output

Please Press CTRL,ALT and DELETE
Here is the out put of the program Hello World
var person = { firstName:"John", lastName:"Doe", age:50, eyeColor:"blue" } E = m c2

0 Comment "HTML Computer Code Elements"