<code>: The Inline Code element
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015 .
The
<code>
HTML
element displays its contents styled in a fashion intended to indicate that the text is a short fragment of computer code. By default, the content text is displayed using the
user agent's
default monospace font.
Try it
code {
background-color: #eee;
border-radius: 3px;
font-family: courier, monospace;
padding: 0 3px;
Attributes
This element only includes the global attributes .
Examples
A paragraph of text that includes
<code>
:
<p>
The function <code>selectAll()</code> highlights all the text in the input
field so the user can, for example, copy or delete the text.