![]() |
VOOZH | about |
HTML provides the <code> element to display programming code clearly on a webpage, making it visually distinct and easy to read.
The <code> tag displays a C program within a <pre> tag, preserving whitespace and formatting. The C program includes the stdio.h> library and a main function that prints "Hello Geeks".
Syntax:
<code> Computer code contents... </code>Note: The program that is written inside the <code> tag has some different font sizes and font types to the basic heading tag and paragraph tag.
The <kbd> tag is used to define keyboard input. The text between the `<kbd>` tags represents text that should be typed on a keyboard.
Syntax:
<kbd> Contents... </kbd>Example: To demonstrate the implementation of the <kbd> Tag. The <kbd> tag displays keyboard keys "Alt", "+", and "Tab" within the styled text.
The `<pre>` tag in HTML defines a block of preformatted text, preserving spaces, line breaks, tabs, and other formatting characters that browsers usually ignore.
Syntax:
<pre> Contents... </pre>Example: To demonstrate implementing the <pre> Tag in the HTML computer code elements.
The `<samp>` tag is used to define sample output from a computer program. It encloses inline text representing a sample or quoted output from a program.
Syntax:
<samp> Contents... </samp>Example: To demonstrate implementing the <samp> tag in HTML to represent sample output or computer code snippets.
The <var> tag is used specifically to highlight programming variables or mathematical expressions, providing context to the text, which is useful for accessibility and search engines. In most browsers, the content of this tag is displayed in italic format.
Syntax:
<var> Contents... </var>Example: To demonstrate using the <var> tag in HTML that denotes variables and it is styled to differentiate them from regular text, providing emphasis on their significance within the content.