Skip to: content, navigation

by Ian Lloyd

samp (HTML element)

Spec
Depr. Empty Version
No No HTML 2
Browser support full matrix
IE5.5+ FF1+ Saf1.3+ Op9.2+
Full Full Full Full

Example

In this example, a support site provides an explanation of a 404 error:

<p>If the browser spits out an error message such as
    <samp>HTTP 404 - File not found</samp>,
    you may simply have typed the address incorrectly.</p>
Type
inline element
Contains
inline elements only
Contained by
block-level elements, inline elements

Description

The samp element’s purpose is to identify a sample of characters that form the output or result of some process. It’s not often seen in practice, but would most probably be encountered in an online technical manual or support site of some kind.

The example code would render as shown in Figure 1.

Figure 1. Browser output of samp element Example of samp element

Use This For …

This element is used to mark up a sequence of characters or a phrase that forms the output of some kind of machine or computer process.

Compatibility

IE5.5Full
6.0Full
7.0Full
Firefox1.0Full
1.5Full
2.0Full
Safari1.3Full
2.0Full
3.0Full
Opera9.2Full
9.5Full

The samp has good browser support: most of the major browsers render it in a fixed-width font.

User-contributed notes

ID:
#1
Date:
Fri, 28 Mar 2008 10:48:06 GMT
Contributed by:
AutisticCuckoo

In help texts or instructions I think it's appropriate to use SAMP to mark up things like menu items. For instance,

<p>The <samp>File</samp> menu contains...</p>

This can then be styled with CSS, e.g.,

samp {font:menu}

Add a note

To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.

Related Products

The Principles of Beautiful Web Design

Best Seller!

You don’t need to go to Art School to design great looking web sites!

Book Cover: The Principles of Beautiful Web Design

Download the FREE sample chapters