HTML samp tag
HTML

HTML samp tag

Editorial Team
Editorial Team

Follow us on Discord or Telegram to get access to free tutorials and updates.

The HTML samp tag (sample tag) is used to define inline text indicating output from a computer program. Any text within the samp tag is displayed in a monospaced font.

Syntax

<samp>Some text here</samp>

Example – simple samp tag

<p>Computer says...<samp>Keyboard not found. Press F1 to continue.</samp></p>

Output

Computer says...Keyboard not found. Press F1 to continue.

We can achieve richer effect with CSS.

Example

<!DOCTYPE html>
<html>
<head>
    <title>HTML samp tag</title>
    <style>
        samp{
            font-weight: bold;
        }
    </style>
</head>
<body>
    <p>Computer says... <samp>Keyboard not found. Press F1 to continue.</samp></p>
</body>
</html>

Output

Computer says... Keyboard not found. Press F1 to continue.

This element supports HTML Global attributes.