HTML Samp Tag

Reference on the Samp Tag of HTML, its useful example, and a list of its allowed attributes.

The HTML samp element is used to markup samples of source code, such as HTML, css, JavaScript. Etc. Rendering code as text is done by replacing ">" with "&gt;" and "<" with "&lt;".

Most sites are using pre instead.

Attributes

Standard Attributes

Attribute:Value:Description:DTD:
AttrsOther AttributesCommon, Event, I18nSTF

DTD. Defines which document type the attribute is allowed. S=Strict, T=Transitional, F=Frameset.

Example

The below shows how to markup code samples in HTML pages, using samp tags.

 <samp>
  &lt;!DOCTYPE html&gt;
&lt;html lang="en"&gt;

  &lt;head&gt;
    &lt;title&gt;My first Website&lt;/title&gt;
  &lt;/head&gt;

  &lt;body&gt;
    &lt;p&gt;My first Website.&lt;/p&gt;
  &lt;/body&gt;

&lt;/html&gt;
 </samp>

Brugbart Vision!

Post comment

Links that you insert are not nofollowed, but will be removed by admins if they are considered spam.

[url=Absolute URL for page]TITLE[/url]

You should insert code boxes around code examples, which will be automatically syntax highlighted.

[code1 html|css|javascript|php|sql]Your Code Here[/code1]

You may want to read our Privacy Policy before submitting your comment.