HTML <samp> Tag
The <samp> tag contains sample output from a computer program or a script. In the browser, the content of the tag is displayed in a monospace font, by default.
The <samp> tag is a phrasing content element indicating that a text section has structural meaning.
You can achieve a better effect with CSS, though the <samp> tag is not deprecated.
The default font face of the browser can be overridden with a CSS rule for the <samp> tag, typically using the font-family property. However, browser preferences or user-agent stylesheets may take priority over any specified CSS.
You can use the <output> tag instead of <samp> if you want an element to serve as a container for the output created by the website or JavaScript code.
Syntax
The <samp> tag comes in pairs. The content is written between the opening (<samp>) and closing (</samp>) tags.
Example of the HTML <samp> tag:
HTML <samp> Tag
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
</head>
<body>
<p>You see an ordinary text here. <samp>But this is a sample text.</samp> And another ordinary text.</p>
</body>
</html>Result

In HTML, there are other elements used to specify the parts of a technical document: the <code> tag is used for defining computer program source code, the <kbd> tag is used for specifying a keyboard input, and the <var> tag is used for specifying variables. While both <code> and <samp> use monospace fonts, <code> represents the actual source code, whereas <samp> represents the output generated by that code.
Attributes
The <samp> tag supports the Global attributes and the Event Attributes.
How to style an HTML <samp> Tag
samp {
/* Overrides the default monospace font */
font-family: Arial, sans-serif;
color: #333;
}Practice
What is the purpose of the HTML <samp> tag and how is it used?