How to add preformatted text in HTML?

HTMLFront End TechnologyWeb Development

Use the <pre> tag to add preformatted text in HTML. The HTML <pre> tag is used for indicating preformatted text. The code tag surrounds the code being marked up.

Browsers normally render pretext in a fixed-pitched font, with whitespace intact, and without word wrap.


You can try to run the following code to learn how to work with <pre> tag −

<!DOCTYPE html>
      <title>HTML pre Tag</title>
         This text is
         in a fixed-pitch
         font, and it preserves
         both spaces and line breaks
Updated on 24-Jun-2020 08:05:11