Table of Contents
INTRODUCTION
The <samp> element is used to represent sample output from a program, system message, or command-line response. The HTML samp element is an inline element.
Display: By default, the text is shown by in the default monospace font of browser.
Syntax:
<samp> - TEXT - </samp>
You can use the <kbd> element along with <samp> element, to showcase an example that includes user-entered text. For instance, here's a transcript of a Linux (or macOS) console session:
Example:
<p>Command Entered:</p>
<p><kbd>ping example.com</kbd></p>
<p>System Output:</p>
<p><samp>
Pinging example.com [93.184.216.34] with 32 bytes of data:
Reply from 93.184.216.34: bytes=32 time=20ms TTL=58
Reply from 93.184.216.34: bytes=32 time=22ms TTL=58
Reply from 93.184.216.34: bytes=32 time=21ms TTL=58
Reply from 93.184.216.34: bytes=32 time=19ms TTL=58
</samp></p>
Output:
Command Entered:
ping demo-example.com
System Output:
Pinging demo-example.com [93.184.216.34] with 32 bytes of data:
Reply from 93.184.216.34: bytes=32 time=20ms TTL=58
Reply from 93.184.216.34: bytes=32 time=22ms TTL=58
Reply from 93.184.216.34: bytes=32 time=21ms TTL=58
Reply from 93.184.216.34: bytes=32 time=19ms TTL=58
Tag Omission
The HTML <samp> element must have both start tag and end tag.
ATTRIBUTES
The <samp> element only has global attributes.