Summary
The HTML <samp> element is an element intended to identify sample output from a computer program. It is usually displayed in the browser's default monotype font (such as Lucida Console).
Content categories | Flow content, phrasing content, palpable content. |
---|---|
Permitted content | Phrasing content. |
Tag omission | {{no_tag_omission}} |
Permitted parent elements | Any element that accepts phrasing content. |
DOM interface | {{domxref("HTMLElement")}} |
Attributes
This element only includes the global attributes.
DOM Interface
This element implements the HTMLElement
interface.
Implementation note: up to Gecko 1.9.2 inclusive, Firefox implements the HTMLSpanElement interface for this element.
Example
<p>Regular text. <samp>This is sample text.</samp> Regular text.</p>
Result
Regular text. This is sample text. Regular text.
Specifications
Specification | Status | Comment |
---|---|---|
{{SpecName('HTML WHATWG', 'text-level-semantics.html#the-samp-element', '<samp>')}} | {{Spec2('HTML WHATWG')}} | |
{{SpecName('HTML5 W3C', 'text-level-semantics.html#the-samp-element', '<samp>')}} | {{Spec2('HTML5 W3C')}} | |
{{SpecName('HTML4.01', 'struct/text.html#h-9.2.1', '<samp>')}} | {{Spec2('HTML4.01')}} |
Note
A CSS rule can be defined for the samp
selector to override the browser's default font face. Preferences set by the user might take precedence over the specified CSS.
See also
{{ HTMLRef }}