<samp>

The HTML <samp> element is used to indicate sample output from a computer program or system, typically shown in a monospace font to represent code or results from commands.

<samp> Tag

The <samp> element is used to display sample output generated by a program, script, or system command. It is typically styled in a monospaced font to visually distinguish system responses from regular text.

Syntax

index.html
<samp>Sample Output Text</samp>

<samp> Demo

The result of the command is: File not found

index.html
<p>
  The result of the command is: <samp>File not found</samp>
</p>
The <samp> tag is still valid, but CSS can provide more flexible styling options.

Attributes

The <samp> element supports global attributes.

Key Points

  • Purpose: Used to display sample output from commands or scripts, making it easier to distinguish system-generated responses.
  • Styling: Rendered in a monospaced font to resemble terminal or console output.
  • Usage: Ideal for documentation, tutorials, and examples that include program or command outputs.

See Also

Conclusion

The <samp> tag is useful for presenting sample output from computer programs, scripts, or system commands. It helps maintain readability by using a monospaced font to mimic terminal responses. While the tag is still widely supported, CSS allows for additional customization and styling.