HTML Computer Code

HTML Computer Code

HTML Computer Code

HTML Computer code is used to write computer language programming language codes on the web page. kbd tag, samp tag, and code tag change the font style of the text and make it smaller than actual text which is suitable to write computer code.

HTML Keyboard Input

  • HTML Keyboard input is used to write keyboard inputs like (Ctrl+C, F5 etc.) on the web page.

  • HTML Keyboard input is defined by <kbd> tag.

HTML Computer Output

  • HTML Computer output is used to write computer output like (Error!, Access denied, File Not Found etc.) on the web page.

  • HTML Computer output is defined by <samp> tag.

HTML Computer Code

  • HTML Computer code is used to write computer code like (#include, function() etc.) on the web page.

  • HTML Computer code is defined by <code> tag.

"The default font family of <kbd>, <samp>, <code> tag is monospace because that is the most appropriate to write computer code."

Example:
<kbd>Ctrl+C</kbd>
<samp>Error!</samp>
<code>function()</code>
Run Code »
Example Explanation:

In the above, we have shown an example of HTML Computer Code.

  • As per visual appearance all 3 tags (kbd, samp, and code) looks same and have same font family also that is monospaced;
    However, it is recommended that we should use kbd for keyboard input, samp for computer output and code to write the programming code.

For More What are the differences between kbd, samp and code in HTML

Run the code to see the effect.




HTML Computer Code in Hindi

Best Use:360p or more (480p or 720p)
×

Course Menu