HTML <samp> tag
The <samp> tag is used to display text as sample computer code.
Standard attributes
class, dir, id, lang, style, title, xml:lang
For more information on standard attributes, check out our HTML standard attributes reference page.
Event attributes
onclick, ondblclick, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onkeydown, onkeypress, onkeyup
For more information on event attributes, check out our HTML event attributes reference page.
Example
Here is some regular text
<samp>Here is some sample computer code</samp>
What was that Javascript code again?
<samp>document.write("Hello " + name + "!");</samp>
Output:
Here is some regular text
Here is some sample computer code
What was that Javascript code again?
document.write("Hello " + name + "!")