The "code" Element


Additional links:

The "code" element represents a fragment of computer code, like an XML element name, a file name, a computer program, or any other text that a computer would recognize.

Attributes for "code"
TypeAttribute List
'Standard' Attributes"is"
New HTML 5.2 Attributes"slot"
Examples for "code"
How it rendersThis is how your browser renders "code" with our stylesheet (this text is in a "code" element).


  • There is no formal way to specify the language of the computer code being marked up, but the "class" attribute can be used to specify a class with a prefix of "language-", like class="language-cpp", class="language-html", class="language-javascript", class="language-pascal", etc.

Recommended Links

Search Engine Links (for more information)

Help us improve this page: Suggest a link or noteReport a problem