Learning HTML 3.2 by Examples, section 5 Descriptions of HTML 3.2 tags:

SAMP - sample output


To present sample output from programs, commands, scripts etc.

Typical rendering

Monospaced. See general notes on rendering markup.

Basic syntax


Possible attributes


Allowed context

Text container, i.e. any element that may contain text elements. This includes most HTML elements. In particular, text elements can be nested.


Text elements. Notice that this disallows e.g. paragraph breaks.


Example SAMP-1.html:

The fatal error message <SAMP>Bus error - core dumped</SAMP> can be caused
by very different bugs in your program.


As usual in HTML, division into lines and the use of blanks and tabs is selected by the browser, not honoring the one in the HTML file. Thus, large pieces of output are more suitably presented using the PRE element or as separate text files to which you have links in HTML files.

In HTML 2.0 this element was defined as follows:

The SAMP element indicates a sequence of literal characters, typically rendered in a mono-spaced font. For example:

The only word containing the letters <samp>mt</samp> is dreamt.
However, since the HTML 3.2 description is more specific and restrictive, you should use SAMP only to present sample output, not e.g. in the way the example in the HTML 2.0 specification suggests.

See also notes on presenting interaction with computer and general remarks on phrase elements.

Date of last update: 2010-12-16.
This page belongs to the free information site IT and communication, section Web authoring and surfing, by Jukka "Yucca" Korpela.