HTML Tutorial

HTML Tag: <samp>

Usage:

The <samp> tag is used to represent sample output from a computer program or script. It visually distinguishes sample code or user input from the surrounding text.

Attributes:

The <samp> tag does not support any specific attributes.

Examples:

  • <samp>The command line output is: $ ls</samp>
  • <samp>Enter your username:</samp>
  • <samp>The result of the calculation is: 42</samp>

Simple HTML Example:

<!DOCTYPE html>
<html>
<head>
  <title>Exploring the &lt;samp&gt; Tag</title>
</head>
<body>
  <h1>Sample Output</h1>
  <p>Here is an example of the <code>&lt;samp&gt;</code> tag:</p>
  <samp>The command line output is: $ ls</samp>
</body>
</html>

Accessibility and Ease of Use:

Assistive technologies, such as screen readers, may announce the <samp> tag as "sample output" or "sample code." This helps users understand the nature of the content and distinguish it from regular text.