Output Tags

These tags are often used to display computer/programming code. You might be surprised for “how to display the text containing the spaces, line breaks, programming codes, sample text, define variable”. Do not worry, because in this chapter we are going to show you how easily you can do easily.
 
So lets start with these tags:
 
Tag Description
<pre> Defines preformatted text
<code> Defines computer code text
<tt> Defines teletype text
<kbd> Defines keyboard text
<var> Defines a variable
<dfn> Defines a definition term
<bdo> Defines the direction of text display
<samp> Defines sample computer code
 
 
<pre>………</pre>Tag
This is preformatted text. It preserves both spaces and line breaks. The pre tag is good for displaying computer code.
 
Format:
<pre> …..text…..</pre>
 
Example:
<pre> for i = 1 to 10
print i
next i
</pre>
 
Output:
for i = 1 to 10
print i
next i
 
 
<code> …..text ……</code> Tag
This tag is also used to display the computer code. But better you use <pre> tag.
 
Format:
<code> …..text…..</code>
 
 
<kbd>…..Keyboard Input……</kbd> Tag
This tag displays the Keyboard Input.
 
Format:
<kbd> …….. Keyboard Input……</kbd>
 
 
<tt>……text….</tt> Tag
This tag displays the typewriter text.
 
Format:
<tt> …..text…..</tt>
 
 
<samp>….sample text…</samp> Tag
This tag displays the sample text.
 
Format:
<samp> …..sample text…..</samp>
 
 
<var> computer variable </var>
This tag defines the computer variable.
 
Format:
<var> computer variable </var>
 
<dfn> definition term </dfn>
this tag is used for definition term.
 
Examples of output tags
 
Examples Outputs
<pre> It preserve all spaces </pre> It preserve all spaces
<code>Computer code</code> Computer code
<kbd>Keyboard input</kbd> Keyboard input
<tt>Teletype text</tt> Teletype text
<samp>Sample text</samp> Sample text
<var>Computer variable</var> Computer variable
<dfn>Definition term</dfn> Definition term
 
Now you have learned the Output Tags so lets do some practical. Below there is a file type the same code on notepad (any text editor) and save it. now open this file in the internet browser.
 
Example:
<html>
<body> <code>Computer code</code>
<br>
<kbd>Keyboard input</kbd>
<br>
<tt>Teletype text</tt>
<br>
<samp>Sample text</samp>
<br>
<var>Computer variable</var>
<br>
<p>
<b>Note:</b>
These tags are often used to display computer/programming code.
</p>
</body>
</html>
Scroll to Top