The HTML <samp> tag

Definition and Usage

<samp> Labels are used to define sample output of computer programs. The content within the label will be displayed in the default monospaced font of the browser.

Tip:This label is not deprecated. However, richer effects can be achieved by using CSS.

See also:

Label Description
<code> Define sample output of a computer program.
<kbd> Define keyboard input.
<var> Define variables.
<pre> Define preformatted text.

See also:

HTML Tutorial:HTML Text Formatting

HTML DOM Reference Manual:Samp Object

Example

Define some text as an example of the output of a computer program in the document:

<p>Message from my computer:</p>
<p><samp>File not found.<br>Press F1 to continue</samp></p>

Try It Yourself

Global Attributes

<samp> The tag also supports Global Attributes in HTML.

Event Attributes

<samp> The tag also supports Event Attributes in HTML.

Default CSS Settings

Most browsers will display the following default values <samp> Element:

samp {
  font-family: monospace;
}

Try It Yourself

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support