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.

Buy me a coffeeBuy me a coffee

Leave a Reply

Your email address will not be published.Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Facebook Twitter Instagram YouTube Pinterest