The <code> tag in HTML is used to define the piece of computer code. During the creation of web pages sometimes there is a need to display computer programming code. It could be done by any basic heading tag of HTML but HTML provides a separated tag which is <code>.
The code tag is a specific type of text which represent computer output. HTML provides many methods for text-formatting but <code> tag is displayed with fixed letter size, font, and spacing.
<code> Contents... </code>
The program which is written inside the <code> tag has some different font size and font type to the basic heading tag and paragraph tag. <pre> tag is used to display code snippet because it always keeps the text formatting as it.
Some points about <code> tag:
- It is mainly used to display the code snippet into the web browser.
- This tag styles its element to match computer’s default text format.
- The web browsers by default use a monospace font family for displaying <code< tags element content.
Supported Browsers: The browser supported by <code> tag are listed below:
- Google Chrome
- Internet Explorer
- What purpose does a <script> tag serve inside of a <noscript> tag?
- Difference between <article> tag and <section> tag
- Why <big> tag is not in HTML5 while <small> tag exists ?
- HTML | <html> Tag
- HTML | <section> Tag
- HTML | Style Tag
- HTML | <marquee> tag
- Div Tag | HTML
- HTML | <noframes> Tag
- span Tag | HTML
- HTML | <picture> Tag
- HTML | <font> Tag
- HTML 5 | <header> Tag
- HTML | <hgroup> Tag
- HTML | <q> Tag
- HTML | Object tag
- HTML | Phrase Tag
- HTML 5 | <summary> Tag
- HTML | <hr> Tag
- HTML | <nav> Tag
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.