<samp> Tag in HTML | Sample Output

The <samp> tag in HTML is used to represent sample output from a computer program or script. It is often used in technical documentation or tutorials where the output of a code is displayed. Text inside the <samp> tag is typically styled with a monospaced font to resemble code output.

Key Points on <samp> Tag:

Syntax of <samp> Tag:

Syntax Example

<samp>Your sample output here</samp>

Example of <samp> Tag in HTML:

This example demonstrates how to use the <samp> tag to display the output of a program.

Code Example

<!DOCTYPE html>
        <html lang="en">
        <head>
            <meta charset="UTF-8">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <title>HTML <samp> Tag Example</title>
        </head>
        <body>
            <h1>Sample Program Output</h1>
            <p>
                The following is the output of the program:
            </p>
            <samp>Process completed successfully</samp>
        </body>
        </html>

Output

Sample Program Output

following is the output of the program:

Process completed successfully

The <samp> tag is useful for displaying sample output in HTML documents. By styling text in a monospaced font, it clearly distinguishes program output or other types of non-interactive results from regular text. This tag helps in creating technical content and tutorials where it's important to show what the output of a program might look like.