Loading Please Wait...
HTML supports various elements to display computer codes such user input, program output, variables definition, etc.
Computer code elements includes <code>, <kbd>, <samp>, and <var>
The <code> element defines computer code such as HTML, CSS, JavaScript, C, PHP, etc. The text inside <code> is displayed in default font of browser that is monospace.
<!DOCTYPE html>
<html>
<body>
<code>
function myFun(){
documnet.write('Hello World');
}
</code>
</body>
</html>
The <code> element ignores line break and whitespace, you can use <code> element inside <pre> to achieve this.
<!DOCTYPE html>
<html>
<body>
<pre>
<code>
function myFun(){
documnet.write('Hello World');
}
</code>
</pre>
</body>
</html>
The <kbd> element defines computer input such keyboard shortcuts. The text inside <kbd> is displayed in default font of browser that is monospace.
<!DOCTYPE html>
<html>
<body>
<p>To copy text press: <kbd>CTRL + C</kbd></p>
</body>
</html>
The <samp> element defines sample output generated from computer program. The text inside <samp> is displayed in default font of browser that is monospace.
<!DOCTYPE html>
<html>
<body>
<samp>File uploaded successfully. Click Browse to upload more files.</samp>
</body>
</html>
The <var> element defines variables used in program, equations, etc. The text inside <var> is displayed in italic.
<!DOCTYPE html>
<html>
<body>
<p>
Aria of rectangle = <var>l</var> x <var>w</var>.
Where <var>l</var> is length and <var>w</var> is width of rectangle.
</p>
</body>
</html>
How you feel about this blog:
Share this blog on:
If you find any error in the turtorials, or want to share your suggestion/feedback, feel free to send us email at: info@lynxsia.com
Contact UsWe are concern with various development process like website design & development, E-commerce development, Software development, Application development, SMS & Bulk SMS Provider, PWA Development, and many more..
Copyright ©
, Lynxsia IT Solutions, All rights reserved