Content · Web Development · HTML

HTML <samp> Element: Sample Program Output

Samp marks example output from a program or computer system. It tells readers they are seeing a result, not an instruction to type.

1 views Published Oct 19, 2026 Updated Oct 19, 2026 Admin

Samp marks example output from a program or computer system. It tells readers they are seeing a result, not an instruction to type.

What You Need to Know


Use kbd for input and code for source code. A pre wrapper helps when several output lines must stay on separate lines.

The goal is not to collect as many tags as possible. Pick the element that best describes what the content really is.

Example: See It in Action


This example keeps the idea small. Copy it carefully, then follow the explanation instead of guessing what the browser will do.

This is a short HTML fragment. To try it as a webpage, put it inside the body element of a complete HTML document.

<p>When the command succeeds, it shows:</p>
<pre><samp>Build complete.
        No errors found.</samp>
</pre>
<p>This is an example of computer output.</p>

Let’s Understand the Example


  • Samp identifies output from a computer program.
  • A p groups a paragraph of related text. Start another paragraph for a new thought.
  • Pre preserves ordinary spacing and line breaks so formatted examples remain readable.

Look for the text “When the command succeeds, it shows:” in the page. If the visible result surprises you, inspect the rendered elements to see what the browser actually built.

What Should You See?


The page should include “When the command succeeds, it shows:”. If it looks different from what you expected, open developer tools and compare the source with the elements the browser created.

Try removing one piece of markup in a scratch copy, refresh the page, and compare the behavior. This is often the fastest way to understand what that piece contributes.

Try It Yourself


  1. Add a third line of sample output and explain its meaning.
  2. Save your changes, open or refresh the page, and compare the result with the original example.
  3. Tell a friend what your change did. If you are not sure, undo it, refresh the page, and compare.

Common Beginner Mistakes


  • Presenting command output as if users should type it themselves.
  • Avoid picking tags just for their default bold, italic or spaced appearance. Use CSS for presentation.

Key Takeaways


  • Samp marks example output from a program or computer system.
  • Samp identifies output from a computer program.
  • Use kbd for input and code for source code. A pre wrapper helps when several output lines must stay on separate lines.
Share this resourceSend this page to someone who may find it useful.