Text Content
HTML <code> element
Marks a fragment of computer code. Combine with pre for a multiline sample and escape literal HTML markup. Inline code identifies a code fragment; it does not execute the text. Use pre for multiline whitespace, and encode less-than and ampersand characters when displaying HTML source. It accepts global HTML attributes; individual global features may be inapplicable or restricted.
Formal Syntax & Structure
html syntaxhtml
<code>Code</code>Return Value
HTMLElement
Content model: Phrasing content, with element-specific restrictions.
Working Example
Example Snippethtml
<!doctype html><html lang="en"> <head> <meta charset="utf-8"> <title>HTML example</title> </head> <body> <p> Use <code><p></code> for a paragraph. </p> </body></html>