HTML samp tag

The HTML samp tag (sample element) is used to define a span of text denoting output from a computer program. It is usualy displayed in monospaced font.

HTML samp tag

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.


Share Tweet Send
Loading...