The Speed Coding

HTML <samp> Tag


Example

Define some text as sample output from a computer program in a document:

<p>Message from my computer:</p >

<p><samp > File not found.<br>Press F1 to continue</samp></p >

Definition and Usage

The <samp> tag is used to define sample output from a computer program. The content inside is displayed in the browser's default monospace font.

Tip: This tag is not deprecated. However, it is possible to achieve richer effect by using CSS.

Also look at:

Tag Description
<code> Defines a piece of computer code
<kbd> Defines keyboard input
<var> Defines a variable
<pre> Defines preformatted text

Browser Support

Element
<samp> Yes Yes Yes Yes Yes

Global Attributes

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


Event Attributes

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


Related Pages

HTML tutorial: HTML Text Formatting

HTML DOM reference: Samp Object


Default CSS Settings

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

Example

samp {
  font-family: monospace;
}