The coding elements indicate that the text inside <code>…</code> is a short part of the computer code.When you want to add programming code to your web page, you can use <code> element. By default, the content of the coding elements is displayed in default monospace font. Inside the code element, you can find a piece of a program in any programming language, an HTML or XML document, a set of CSS declarations, the contents of a configuration file, etc.
The HTML <pre> element represents preformatted text which is to be presented exactly as written in the HTML file. Whitespace inside this element is displayed as written. The text is rendered using a non-proportional (“monospace”) font.
The <kbd> tag in HTML defines a keyboard input. It is used to identify text that represents user keyboard it means input text should be typed on a keyboard.
Text written inside <kbd> tags is displayed in the monospace font(all characters have the same width).
Example:
<p> Use these keys to save your document: <kbd><kbd> Ctrl </kbd> + <kbd> S </kbd></kbd>
In HTML <samp> tag is an inline element and used to indicate sample output from a computer program or script. The content written inside <samp> tag is displayed in monospace format. It is used to display output from a process, such as an error message from a computer script.
Example:
<p> The output of the program is <samp> Hello World! </samp></p>
The varibles in HTML are defined using <var> tag. The <var> tag is a phrase tag that is used to define the variable for a mathematical equation or in the programming context. The content written inside <var>…..</var> tag renders in the italic.
Example:
<p> Pythagoras theorem formula: <var> a </var><sup> 2 </sup> + <var> b </var><sup> 2 </sup> = <var> c </var><sup> 2 </sup>
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok