This wiki has been archived and is now read-only.


From HTML Wiki
Jump to: navigation, search


The <code> element represents a fragment of computer code.


  • For example of computer code:
    • XML element name
    • filename
    • computer program

etc. Any other string that a computer would recognize.

HTML Attributes

See global attributes.


Example A

The following example shows how a block of code could be marked up using the pre and code elements [try it]:

  function Panel(element, canClose, closeHandler) {
    this.element = element;
    this.canClose = canClose;
    this.closeHandler = function () { if (closeHandler) closeHandler() };

HTML Reference

The HTML5 specification defines the <code> element in 4.6.11 The code element.