HTML <code> Tag
Description
The HTML <code>
tag is used to enclose a section of text that represents computer code, such as programming code or markup language snippets. When this tag is applied to text, it typically renders the enclosed content in a monospaced or fixed-width font, making it stand out from the surrounding text and indicating that it should be interpreted as code rather than regular text. This tag is commonly used in documentation, tutorials, and programming-related web content to ensure that code examples are easily distinguishable and readable for the audience.
Properties
- Permitted Parents
- Any element that accepts phrasing content
- Content
- Inline and text
- Start/End Tags
- Start tag: required, End tag: required
Example
To create a new array, type the following: <code>var faq = new Array(3)</code>
Attributes
None
Global Attributes
The <code>
tag also supports the Global Attributes in HTML5
Event Attributes
The <code>
tag also supports the Event Attributes in HTML5
Browser Support
The following table will show you the current browser support for the HTML <code>
tag.
Desktop | |||||
![]() |
![]() |
![]() |
![]() |
![]() |
|
12 | 1 | 1 | 15 | 4 |
Tablets / Mobile | |||||
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
18 | 4 | 14 | 3.2 | 1 | 4.4 |
Last updated by CSSPortal on: 30th September 2023