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
- Inline HTML Helper - HTML Helpers in ASP.NET MVC
- HTML | <html> xmlns Attribute
- HTML Course | Structure of an HTML Document
- HTML | DOM HTML Object
- HTML Course | Basics of HTML
- What is the difference between <html lang="en'> and <html lang="en-US'> ?
- HTML | b Tag
- HTML | <kbd> Tag
- HTML | <rtc> Tag
- HTML | col Tag
- HTML | <ul> Tag
- HTML | bdo Tag
- HTML | th Tag
- HTML | dl Tag
- HTML | dt Tag
- Div Tag | HTML
- HTML | <!--...--> Tag
- HTML | <s> Tag
- HTML | <var> Tag
- HTML 5 | <bdi> 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 email@example.com. 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.