Jump to content

<xmp> tag


Recommended Posts

<xmp> tag

Capture.JPG

Specification

HTML:

3.2

4.01

5.0

XHTML:

1.0

1.1

Description

The <xmp> tag displays the contents of the container "as is" and in a fixed-width font. While the <xmp> tag is not closed, all tags within it are displayed as plain text.

Syntax

< xmp>Text</xmp>

Closing tag

Required.

Attributes

Not.

Example

<!DOCTYPE html>
<html>
 <head>
  <meta charset="utf-8">
  <title>XMP Tag</title>
 </head>
 <body>
  <p>Sample program</p>
  <xmp>
   while (<>) {
     $org=$_;
     s/\\["']//g;
     s/\/\/[^:].*//;
     s/\/\*.*\*\///g;
     if ($comment == 1) {
       if (s/.*\*\///) {
         $comment = 0;
       }
       else {
         next;
       }
     }
     if (s/\/\*.*//) {
       $comment = 1;
     }
     if (/^\s*#/) {
       next;
     }
   }</xmp>
 </body>
</html>

The result of this example is shown below:

Type of text formatted using the <xmp> tag

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.