Advertisement
❮ Previous: <s> Next: <script> ❯

<samp>

HTML <samp> (Sample Text) Tag

Example

<p>This is <samp>sample</samp> text</p>

Try this code ❯

Meaning

The <samp> logical inline element is used to specifies sample text. Enclosed text generally is rendered in a monospaced font.

The <samp> is useful to bind style rules to.

By default, most browsers render the contents of <samp> elements in a fixed-width, monospaced font, but you can change that with CSS properties.

If you are looking to mark up programming code, the <code> element would be more appropriate.

If you are looking to indicate user input (e.g. from a keyboard), the <kbd>kbd element is more appropriate.

Note: The samp element is a phrasing-level element. It must not contain block-level elements, but it can contain other phrasing-level elements.

Version: HTML 2, 3.2, 4, 4.01, 5


Standard Syntax

<samp>...</samp>


Advertisement

Global Attributes

The <samp> element also supports the Global Attributes in HTML.


Event Attributes

The <samp> element also supports the Event Attributes in HTML.


By Default CSS Value(s)

Most of the browsers will display the <samp> element with the following by default value(s)

samp { 
  font-family: monospace;
}

Related Tags:

<a>,
<abbr>,
<b>,
<bdi>,
<bdo>,
<br>,
<cite>,
<code>,
<data>,
<dfn>,
<em>,
<i>,
<kbd>,
<mark>,
<q>,
<rp>,
<rt>,
<ruby>,
<s>,
<small>,
<span>,
<strong>,
<sub>,
<sup>,
<time>,
<u>,
<var> and
<wbr>

❮ Previous: <s> Next: <script> ❯
Advertisement