Description

The <samp> (short for sample) tag specifies text as sample code. It typically represents sample output from a computer programs, scripts, etc.

The following table summarizes the usages context and the version history of this tag.

Placement:Inline
Content:Inline and text
Start/ End Tag:Start tag: required, End tag: required
Version:HTML 2, 3.2, 4, 4.01, 5

Usage Notes: By default, browsers display the sample text in a monospace font, such as "Courier New", but you can override this style using the CSS font-family property.

Syntax

The basic syntax of the <samp> tag is given with:

HTML/XHTML: <samp> ... </samp>

The example below shows the <samp> tag in action.

<p>If the browser display an error message such as <samp>HTTP 404 - File not found</samp>, you may simply have typed the incorrect url address.</p>

Tag-Specific Attributes

The <samp> tag doesn't have any specific attribute.

Global Attributes

Like all other HTML tags, the <samp> tag supports the glodelal Attributes in HTML5.

Event Attributes

The <samp> tag also supports the event Attributes in HTML5.

Browser Compatibility

Element
<samp>YesYesYesYesYes