HTML <samp> Tag

The ><samp> tag contains sample output from a computer program or a script. In the browser, the content of the tag is by default displayed in monospace font.

Syntax

The <samp> tag comes in pairs; its content is written between the opening (<samp>) and the closing (</samp>) tags.

Example

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
  </head>
  <body>
    <p>You see an ordinary text here. <samp>But this is a sample text.</samp> And another ordinary text.</p>
  </body>
</html>

Result

In HTML, there are other elements used to define parts of a technical document: the <code> tag is used for defining the computer program output; the <kbd> tag is used for specifying a keyboard input; and the <var> tag is used for specifying variables.

Attributes

The <samp> tag supports the Global attributes and the Event Attributes.

Browser support





Related articles