The computer is a machine, Computer Understand the binary code that is 0 or 1. when we are programming, some time show the output, error message, coding part to the user on webpage.
To display the computer code on web page used following tags.
To display the computer code on web page used following tags.
- <code>
- <pre>
- <kbd>
- <var>
- <samp>
The HTML <kbd> tag is used to defines a keyboard input. code written between <kbd>.........</kbd> tag is typically displayed in the browser's default monospace font.
Example:-
<html>
<body>
<h2>The kbd Element</h2>
<p>Save the Document <kbd>Ctrl + S</kbd></p>
<p>Copy the Document <kbd>Ctrl + C</kbd></p>
<p>Paste the Document <kbd>Ctrl + V</kbd></p>
<p>Undo the Document <kbd>Ctrl + Z</kbd></p>
<p>Cut the Document <kbd>Ctrl + X</kbd></p>
</body>
</html>
Output:-

HTML <code> Tag
The HTML <code> element is used to define a piece of computer code. The content inside is displayed in the browser's default monospace font.
Example:-
<html>
<body>
<h2>The code Tag</h2>
<p>Programming code example:</p>
<code>
x = 5;
y = 6;<br>
z = x + y;
</code>
</body>
</html>
Output:-

HTML <var>
The HTML <var> element is used to defines a variable in programming or in a mathematical expression. The content inside is typically displayed in italic.
Example:-
<html>
<body>
<h2>The var Tag</h2>
<p>The area of a triangle is: 1/2 x <var>b</var> x <var>h</var>, <br>where <var>b</var> is the base, and <var>h</var> is the vertical height.</p>
</body>
</html>
Output:-

HTML <pre> Tag
The <pre> tag in HTML is used to set preformatted text. The text in it preserved spaces and line breaks i.e. the text appears the same in the web page as it is added under the HTML code.
Example:-
<html>
<body>
<h2>Pre Tag</h2>
<pre>
HTML Language Study
This is a blog
All post related to HTML Language
</pre>
</body>
</html>
Output:-

The HTML <samp> tag is used to define sample output from a computer program. The content inside is displayed in the browser's default monospace font.
Example:-
<html>
<body>
<h2>samp Tag</h2>
<p>The samp tag is used to define sample output from a computer program.</p>
<p>Message from my computer:</p>
<p><samp>File not found.<br>Press F1 to continue</samp></p>
</body>
</html>

0 Comments
Post a Comment
Please do not enter any spam in the comment box.