HTML samp tag
HTML

HTML samp tag

Mishel Shaji
Mishel Shaji

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.