How do you do plain text in html?

The <plaintext> tag tells the browser, that its content must be displayed as an ordinary text without formatting. All the nested tags in this element are rendered by the browser as a part of the text. The content of the <plaintext> tag is represented in monospaced font. The monospaced font can be applied to any HTML element using the CSS font-family style with the "monospace" generic value.

In the case, where <plaintext> is the first element on the page, using HTML is not preferable. Instead, you can serve a text file with the text/plain MIME-type.

Syntax

The <plaintext> tag is empty, which means that the closing tag isn’t required.

Example of the HTML <plaintext> property:

<!DOCTYPE html>
<html>
 <head>
    <title>Title of the document</title>
 </head>
  <body>
    <p>The tag content looks like this:</p>
    <plaintext>
    <h2>Main title of the document</h2>
    <p>First paragraph of the text</p>
    <h2>Subheading</h2>
  </body>
</html>

Result

How do you do plain text in html?

Attributes

The <plaintext> tag supports the Global Attributes.

Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

The <plaintext> HTML element renders everything following the start tag as raw text, ignoring any following HTML. There is no closing tag, since everything after it is considered raw text.

Warning: Do not use this element.

  • <plaintext> is deprecated since HTML 2, and not all browsers implemented it. Browsers that did implement it didn't do so consistently.
  • <plaintext> is obsolete; browsers that accept it may instead treat it as a <pre> element that still interprets HTML within.
  • If <plaintext> is the first element on the page (other than any non-displayed elements, like <head>), do not use HTML at all. Instead serve a text file with the text/plain MIME-type.
  • Instead of <plaintext>, use the <pre> element or, if semantically accurate (such as for inline text), the <code> element. Escape any <, > and & characters, to prevent browsers inadvertently parsing content the element content as HTML.
  • A monospaced font can be applied to any HTML element via a CSS font-family style with the monospace generic value.

Attributes

This element has no other attributes than the global attributes common to all elements.

DOM interface

This element implements the HTMLElement interface.

Specifications

Specification
HTML Standard
# plaintext

Browser compatibility

BCD tables only load in the browser

See also

  • The <pre> and <code> elements, which should be used instead.
  • The <listing> and <xmp> elements, which are both obsolete elements similar to <plaintext>.


HTML contains several elements for defining text with a special meaning.


Example

This text is bold

This text is italic

This is subscript and superscript

Try it Yourself »


HTML Formatting Elements

Formatting elements were designed to display special types of text:

  • <b> - Bold text
  • <strong> - Important text
  • <i> - Italic text
  • <em> - Emphasized text
  • <mark> - Marked text
  • <small> - Smaller text
  • <del> - Deleted text
  • <ins> - Inserted text
  • <sub> - Subscript text
  • <sup> - Superscript text

HTML <b> and <strong> Elements

The HTML <b> element defines bold text, without any extra importance.

The HTML <strong> element defines text with strong importance. The content inside is typically displayed in bold.



HTML <i> and <em> Elements

The HTML <i> element defines a part of text in an alternate voice or mood. The content inside is typically displayed in italic.

Tip: The <i> tag is often used to indicate a technical term, a phrase from another language, a thought, a ship name, etc.

The HTML <em> element defines emphasized text. The content inside is typically displayed in italic.

Tip: A screen reader will pronounce the words in <em> with an emphasis, using verbal stress.


HTML <small> Element

The HTML <small> element defines smaller text:


HTML <mark> Element

The HTML <mark> element defines text that should be marked or highlighted:


HTML <del> Element

The HTML <del> element defines text that has been deleted from a document. Browsers will usually strike a line through deleted text:


HTML <ins> Element

The HTML <ins> element defines a text that has been inserted into a document. Browsers will usually underline inserted text:

Example

<p>My favorite color is <del>blue</del> <ins>red</ins>.</p>

Try it Yourself »


HTML <sub> Element

The HTML <sub> element defines subscript text. Subscript text appears half a character below the normal line, and is sometimes rendered in a smaller font. Subscript text can be used for chemical formulas, like H2O:


HTML <sup> Element

The HTML <sup> element defines superscript text. Superscript text appears half a character above the normal line, and is sometimes rendered in a smaller font. Superscript text can be used for footnotes, like WWW[1]:


HTML Exercises


HTML Text Formatting Elements

TagDescription
<b> Defines bold text
<em> Defines emphasized text 
<i> Defines a part of text in an alternate voice or mood
<small> Defines smaller text
<strong> Defines important text
<sub> Defines subscripted text
<sup> Defines superscripted text
<ins> Defines inserted text
<del> Defines deleted text
<mark> Defines marked/highlighted text

For a complete list of all available HTML tags, visit our HTML Tag Reference.



How do you write plain text in HTML?

HTML - <plaintext> Tag The HTML <plaintext> tag is used to render all text in the document exactly as it was typed in, including all tags and even the document tags. This tag ignores all formatting for the rest of the document, displaying all text exactly as is. It cannot be stopped, it cannot be turned off.

Can HTML contain plain text?

The <plaintext> HTML element renders everything following the start tag as raw text, ignoring any following HTML. There is no closing tag, since everything after it is considered raw text. Warning: Do not use this element. <plaintext> is deprecated since HTML 2, and not all browsers implemented it.

How do I add plain text?

Press Command + Spacebar (on your keyboard). Type TextEdit and press Enter . Click Format > Make plain text (from the top menu).