HTML <samp> tag

Definitie en gebruik

<samp> Een tag wordt gebruikt om een voorbeeld van de uitvoer van een computertaalprogramma te definiëren. De inhoud binnen de tag wordt weergegeven in het standaard monospace-lettertype van de browser.

Tip:Deze tag is niet verlaten. Echter, je kunt een rijkere effect bereiken door CSS te gebruiken.

See also:

标签 Description
<code> Define sample output of a computer program.
<kbd> Define keyboard input.
<var> Define variables.
<pre> Define preformatted text.

See also:

HTML tutorial:HTML text formatting

HTML DOM reference manual:Samp object

Example

Define some text as an example of the output of a computer program in the document:

<p>Message from my computer:</p>
<p><samp>File not found.<br>Press F1 to continue</samp></p>

Try it yourself

Global attributes

<samp> The tag also supports Global attributes in HTML.

event attributes

<samp> The tag also supports Event attributes in HTML.

Default CSS settings

Most browsers will display the following default values <samp> Element:

samp {
  font-family: monospace;
}

Try it yourself

Browser support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support