HTML Tag Reference - HTML tag <samp>








This <samp> element displays text in a monospaced or fixed-width font. It is typically used to display code samples.

Browser compatibility

<samp> Yes Yes Yes Yes Yes

What's new in HTML5

None.

Global Attributes

The <samp> tag supports the Global Attributes in HTML.

Event Attributes

The <samp> tag supports the Event Attributes in HTML.

Default CSS Settings

samp { 
    font-family: monospace;
}




Example

A demo showing how to use <samp> tag.

<html>
<body>
     <p>
          You can apply the
          <samp>style</samp>
          attribute to nearly any element.
     </p>
</body>
</html>

Click to view the demo