English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag Directory

HTML: <samp> tag

The HTML <samp> element is used to identify the output of computer programs, typically using the browser's default monotype font (e.g., Lucida Console).

Online Example

Formatting text in the document:

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>HTML samp Tag Usage (Basic Tutorial Website oldtoolbag.com)/title>
</head>
<body>
<p>Normal text. <samp>This is a demonstration text./samp>Normal text./p>
</body>
</html>
Test and see ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

All mainstream browsers support the <samp> tag.

Tag Definition and Usage Description

<samp> tag is a phrase tag used to define sample text of computer programs.

Note: The start tag and end tag cannot be omitted.

Tip: We are not against using this tag, but if you use this tag only to achieve a certain visual effect, we recommend using CSS, which may achieve richer effects.

All phrase tags:

TagDescription
<em>Presented as emphasized text.
<strong>Define important text.
<dfn>Define a definition item.
<code>Define computer code text.
<samp>Define sample text.
<kbd>Define keyboard text. It indicates that the text is typed from the keyboard. It is often used in documents or manuals related to computers.
<var>Define variables. You can use this tag in conjunction with <pre> and <code> tags.

Global Attributes

Support for <samp> tag Global Attributes of HTML.

Event Attributes

Support for <samp> tag HTML Event Attributes.

Related Articles

HTML Tutorial:HTML Text Formatting