HTML - <xmp> Tag



HTML <xmp> tag is used to create any content as letter format. This tag is used basically to create preformatted text.

The <xmp> tag is no longer recommended as it is not supported by HTML5. Instead of using this tag, we can use the <pre> element.

Syntax

<xmp>
   ...
</xmp>

Attribute

HTML strike tag supports Global attributes of HTML.

Examples of HTML xmp Tag

Bellow examples will illustrate the usage of xmp tag. Where, when and how to use xmp tag to specifies preformatted text.

Create preformatted text using xmp Tag

Let's look at the following example, where we are going to use the xmp tag.

<!DOCTYPE html>
<html>
<head>
   <title>HTML xmp Tag</title>
</head>
<body>
   <p>
   HTML tags include 
   <xmp>
      <b> for bold text</b>, <i> 
      for italic text.</i>
   </xmp>
   </p>
</body>
</html>

Style preformatted text of xmp Element

In the following example we will use CSS to style xmp element content.

<!DOCTYPE html>
<html>
<head>
   <title>HTML xmp Tag</title>
   <style>
   xmp{
       color: red;
   }
   </style>
</head>
<body>
   <p>
   This is xmp Element Text 
   <xmp>
      <b>Tutorialspoint</b>
      <kbd>Simply Easy Learning</kbd>
   </xmp>
   </p>
</body>
</html>

Supported Browsers

Tag Chrome Edge Firefox Safari Opera
xmp Yes 1.0 Yes 12.0 Yes 1.0 Yes 4.0 Yes 15.0
html_deprecated_tags.htm
Advertisements