The <samp> tag marks sample output from computer code.
The output text is formatted with a monospaced font.
A <samp> element with output from a mainframe calculation.
The program ran for 3.5 minutes. Here is the output:
*** The first 50 digits of pi are: 3.1415926535 8979323846 2643383279 5028841971 6939937510 ***<p>The program ran for 3.5 minutes. Here is the output:</p>
<samp>
*** The first 50 digits of pi are: 3.1415926535 8979323846
2643383279 5028841971 6939937510 ***
</samp>
samp = sample
A <samp> tag with calculation results (the numbers).
Let's calculate the prime numbers below 200:
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199<p>Let's calculate the prime numbers below 200:</p>
<samp>
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37,
41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83,
89, 97, 101, 103, 107, 109, 113, 127, 131,
137, 139, 149, 151, 157, 163, 167, 173, 179,
181, 191, 193, 197, 199
</samp>
The <samp> element has no attributes, but it does accept global attributes.
The following are commonly used.
| Attribute | Value | Description |
|---|---|---|
| id | value | Provides the samp element with a unique identifier. |
| class | classnames | Assigns one or more classnames to the samp element. |
| style | CSS-values | Assigns CSS style values to the samp element. |
For additional global attributes see our global attributes list.
<samp> tag is one of them, but there several others.A list of all HTML Phrase tags.
| Tag | Description |
|---|---|
| <em> | Indicates emphasized text |
| <strong> | Indicates important text |
| <code> | Indicates computer code |
| <samp> | Indicates sample output from a computer program |
| <kbd> | Indicates keyboard input |
| <var> | Indicates a variable |
The <samp> tag is part of a group of tags
that create coding (programming) related features on web pages.
This group is referred to as the Code tag group.
Together, they allow you to create code-friendly pages.
A list of code tags.
| Element | Description |
|---|---|
| <pre> | Displays pre-formatted text in fixed-width font -- usually computer code |
| <code> | An element that is used to display computer code |
| <samp> | Displays sample output from a coumputer code |
| <output> | Displays output results of a calculation |
| <var> | Defines its content as a variable |
| <!--...--> | Marks text as comments in the source code. Not visible to users |
Here is when <samp> support started for each browser:
![]() Chrome
|
1.0 | Sep 2008 |
![]() Firefox
|
1.0 | Sep 2002 |
![]() IE/Edge
|
1.0 | Aug 1995 |
![]() Opera
|
1.0 | Jan 2006 |
![]() Safari
|
1.0 | Jan 2003 |