Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 500371 of <samp>

  • Revision slug: Web/HTML/Element/samp
  • Revision title: <samp>
  • Revision id: 500371
  • Created:
  • Creator: Tyriar
  • Is current revision? No
  • Comment Not an inline element, updated top table and specification styles

Revision Content

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).

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>

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

{{ languages({ "ja": "ja/HTML/Element/samp", "pl": "pl/HTML/Element/samp"}) }}

{{ HTMLRef }}

Revision Source

<h2 id="Summary">Summary</h2>
<p>The HTML <span style="font-family: Courier New;">&lt;samp&gt;</span> 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).</p>
<div>
 <ul class="htmlelt">
  <li><dfn><a href="/en-US/docs/HTML/Content_categories" title="HTML/Content_categories">Content categories</a></dfn><a href="/en/HTML/Content_categories#Flow_content" style="line-height: 22px;" title="en/HTML/Content categories#Flow content">Flow content</a><span style="line-height: 22px;">,&nbsp;</span><a href="/en/HTML/Content_categories#Phrasing_content" style="line-height: 22px;" title="en/HTML/Content categories#Phrasing content">phrasing content</a>, palpable content.</li>
  <li><dfn>Permitted content</dfn><a href="/en/HTML/Content_categories#Phrasing_content" style="line-height: 22px;" title="en/HTML/Content categories#Phrasing content">Phrasing content</a>.</li>
  <li><dfn>Tag omission</dfn>{{no_tag_omission}}</li>
  <li><dfn>Permitted parent elements</dfn>Any element that accepts&nbsp;<a href="/en-US/docs/HTML/Content_categories#Phrasing_content" title="HTML/Content_categories#Phrasing_content">phrasing content</a>.</li>
  <li><dfn>DOM interface</dfn>{{domxref("HTMLElement")}}</li>
 </ul>
</div>
<h2 id="Attributes">Attributes</h2>
<p><span style="line-height: 21px;">This element only includes the&nbsp;</span><a href="https://developer.mozilla.org/en-US/docs/HTML/Global_attributes" style="line-height: 21px;" title="HTML/Global attributes">global attributes</a><span style="line-height: 21px;">.</span></p>
<h2 id="DOM_Interface">DOM Interface</h2>
<p>This element implements the <code><a href="/en/DOM/element" title="en/DOM/element">HTMLElement</a></code> interface.</p>
<div class="note">
 <p><strong>Implementation note: </strong>up to Gecko 1.9.2 inclusive, Firefox implements the <a href="/en/DOM/span" title="en/DOM/span"><span style="font-family: Courier New;">HTMLSpanElement</span></a> interface for this element.</p>
</div>
<h2 id="Example">Example</h2>
<pre class="brush: html">
&lt;p&gt;Regular text. &lt;samp&gt;This is sample text.&lt;/samp&gt; Regular text.&lt;/p&gt;
</pre>
<h2>Specifications</h2>
<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('HTML WHATWG', 'text-level-semantics.html#the-samp-element', '&lt;samp&gt;')}}</td>
   <td>{{Spec2('HTML WHATWG')}}</td>
   <td>&nbsp;</td>
  </tr>
  <tr>
   <td>{{SpecName('HTML5 W3C', 'text-level-semantics.html#the-samp-element', '&lt;samp&gt;')}}</td>
   <td>{{Spec2('HTML5 W3C')}}</td>
   <td>&nbsp;</td>
  </tr>
  <tr>
   <td>{{SpecName('HTML4.01', 'struct/text.html#h-9.2.1', '&lt;samp&gt;')}}</td>
   <td>{{Spec2('HTML4.01')}}</td>
   <td>&nbsp;</td>
  </tr>
 </tbody>
</table>
<h2 id="Note">Note</h2>
<p>A CSS rule can be defined for the <code>samp</code> selector to override the browser's default font face. Preferences set by the user might take precedence over the specified CSS.</p>
<h2 id="See_also">See also</h2>
<ul>
 <li><a href="/en/HTML/Element/code" title="en/HTML/Element/code">HTML Code Element</a></li>
</ul>
<p>{{ languages({ "ja": "ja/HTML/Element/samp", "pl": "pl/HTML/Element/samp"}) }}</p>
<div>
 {{ HTMLRef }}</div>
Revert to this revision