<samp>

<samp> represents sample or quoted output from a computer program. It normally displays in monospace text, but it neither runs a program nor generates output itself.

Input and output

The command is user input; the completion message is sample output. The caption explains that this is a demonstration, not a live operation.

Inspect samp markupLink

HTML and CSS

HTML

<p>Example command: <kbd>build-site</kbd></p>
<p>Example response: <samp>Build complete: 12 pages.</samp></p>

CSS

samp,
kbd {
  font-family: ui-monospace, monospace;
}

Edit HTML or CSS to update the preview as you type. Copy code snippet copies the selected tab. Preview spacing and font defaults are not included.

Content and alternatives

Samp accepts phrasing content and global attributes. Use pre around samp when output’s line breaks and spacing matter. Use code for program source and kbd for input.

For a calculated result in a form or an application, output may be appropriate. Samp alone is not a live region and does not announce changes automatically.

Inspect the example

Changing the message changes only the displayed sample. There is no build command being executed here. That distinction matters in tutorials: readers should know whether they are viewing expected output, recorded output, or a live result.

Sources and browser support

MDN: samp describes the syntax and links to the specification and compatibility data. Check individual values in that table when supporting older browsers.