HTML <code> Tag
The HTML <code> tag is a phrase tag. It is used to specify a piece of computer code. It displays the contents in the browser’s default monospace font (the fixed-width font).
HTML Phrase Tags:
Tag | Uses |
<em> | To display an emphasized text. |
<strong> | To display an important text. |
<dfn> | To specify a definition term. |
<code> | To specify a piece of computer code. |
<samp> | To specify a sample output from a computer program. |
<kbd> | To specify a keyboard input. |
<var> | To specify a variable. |
Example:
<!DOCTYPE html> <html> <body> <em>HELLO WORLD!!</em><br> <strong>HELLO WORLD!!</strong><br> <code>HELLO WORLD!!</code><br> <samp>HELLO WORLD!!</samp><br> <kbd>HELLO WORLD!!</kbd><br> <var>HELLO WORLD!!</var> </body> </html>
Explanation:
In the above example, we have used the different HTML phrase tags.
Global Attributes:
All the Global attributes are supported by the HTML <code> tag.
Event Attributes:
All the Event attributes are supported by the HTML <code> tag.
Supporting Browsers:
Chrome, IE, Firefox, Opera, and Safari.