Preformatted text

When displaying text, Web browsers normally compress multiple consecutive spaces into a single space and “wrap” paragraphs at the edge of the window so users don’t have to scroll horizontally to see a whole paragraph. This behavior is usually convenient for both authors and users, but there are cases—such as poetry and code samples—where text needs to be displayed exactly as entered by the author. To accommodate such cases, HTML includes an element type called preformatted text.

Preformatted text elements are text blocks that browsers display exactly as given in a document’s source code. Multiple spaces are not compressed, and long lines are not wrapped at the window edge. Additionally, most browsers display preformatted text in a monospaced font by default, although you can specify any font you wish.

Namo Web Editor 4.text.preformatted Preformatted text

Preformatted text compared to normal text.

To create a preformatted text element
  1. Place the insertion point in an empty line.
  2. On the Home menu, go to the Paragraph group, click the Element box and select Preformatted text.
  3. Enter the text. To start a new line, press Enter.
  4. When done entering preformatted text, press Ctrl+Enter to start a normal paragraph.
To convert paragraphs to preformatted text
  1. Select the paragraphs to convert to preformatted text.
  2. On the Home menu, go to the Paragraph group, click the Element box and select Preformatted text.
  3. Click Yes if you want each paragraph to be converted into an individual preformatted text element; click No if you want all the paragraphs to be converted into a single preformatted text element with line breaks between the former paragraphs.
To change the font of some preformatted text
  1. Select some preformatted text.
  2. On the Home menu, go to the Font group, and select a font.
To change the font of all preformatted text in a document
  1. On the Home menu, go to the Style group, and click Define Styles.
  2. Click Namo Web Editor button add style Preformatted text (Add).
  3. Click the Element box, select pre, and click OK.
  4. Click the Font box and select a font. If desired, specify other font properties such as size and style.
  5. Click OK.

Namo Web Editor icon note Preformatted textIf you enter preformatted text in HTML mode, any line breaks within the <pre> element are preserved and displayed as entered.

Preformatted text