This website uses cookies

We use cookies to personalize content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners who may combine it with other information that you've provided to them or that they've collected from your use of their services. Please read more at our privacy policy page.



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 front.

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