How to define preformatted text using HTML? Last Updated : 19 Jun, 2024 Comments Improve Suggest changes Like Article Like Report To define a preformatted text in HTML use the <pre> tag in the document. It is used to define the block of preformatted text that preserves the text spaces, line breaks, tabs, and other formatting characters that are ignored by web browsers. Text in the pre-tag is displayed in a fixed-width font, but it can be changed using CSS. The pre tag requires a starting and ending tag. Syntax:<pre> Contents... </pre>Example 1: html <html> <head> <title>HTML5: How to define preformatted text? </title> <style> h2 { Text-align: center; } </style> </head> <body> <h2>GeeKsForGeeks</h2> <h2>HTML5: How to define preformatted text </h2> <pre> GeeksforGeeks A Computer Science Portal For Geeks </pre> </body> </html> Output: Example 2: The example below shows the preformatted text using HTML. html <html> <head> <title>HTML5: How to define preformatted text? </title> <style> h2 { Text-align: center; } </style> </head> <body> <h2>GeeKsForGeeks</h2> <h2>HTML5: How to define preformatted text </h2> <pre> this is a pre formatted text </pre> </body> </html> Output: Supported Browsers Google Chrome: 129Firefox: 130Safari: 17.6Edge: 125 Comment More infoAdvertise with us Next Article How to define preformatted text using HTML? M manaschhabra2 Follow Improve Article Tags : Web Technologies HTML HTML-Misc HTML-Questions Similar Reads How to define important text using HTML5 ? In this article, we define an important text by using the <strong> tag in HTML. It is the parsed tag and used to show the importance of the text. It reflects the text as bold. Syntax: <strong> Contents... </strong> Example 1: html <!DOCTYPE html> <html> <head> 1 min read How to Define Superscripted Text using HTML? Superscript text is used for footnotes, mathematical exponents, and other notations. To define superscripted text in HTML5, use the <sup> tag. This tag adds superscript text to your HTML document, displaying it half a character above the normal line and often in a smaller font. Syntax<sup 1 min read How to define marked/highlighted text using HTML? To define highlighted or marked text in HTML5, the <mark> tag is employed. It effectively highlights specific text within a paragraph, offering a straightforward way to visually emphasize content. Introduced in HTML5, the `<mark>` tag enhances readability and focus within web content.Syn 1 min read How to Define Subscripted Text in HTML? The subscripted text is defined using the <sub> element, which marks text that appears slightly below the normal line of text. This tag is commonly used for scientific and mathematical notations, chemical formulas (e.g., HâO), and footnotes. Syntax<sub> Content... </sub>Define Subs 1 min read How to define style information of a document using HTML5 ? In this Article, we define style information for a document by using the <style> element in the document. It is used to change our text, viewed on the page. This change includes changing font-size, font-family, font-color, etc. Not only the texts but you can also change the style of a body or 1 min read Like