HTML <samp> Tag

Definition und Verwendung

<samp> Der Tag wird verwendet, um die Beispiel-Ausgabe eines Computerprogramms zu definieren. Der Inhalt des Tags wird in der Standardschriftart des Browsers angezeigt.

Hinweis:Dieser Tag wurde nicht abgekündigt. Allerdings kann eine reichere Wirkung durch die Verwendung von CSS erreicht werden.

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