
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
HTML Tag
The <pre> tag in HTML is used to set preformatted text. The text in it preserves spaces and line breaks i.e. the text appears the same in the web page as it is added under the HTML code.
Let us now see an example to implement the <pre> tag −
Example
<!DOCTYPE html> <html> <body> <h2>Demo Heading</h2> <pre> This is a demo text and will appear in the same format as it is visible here. The pre tag displays the text in a fixed-width font. It preserves both spaces and line breaks as you can see here. </pre> </body> </html>
Output
In the above example, we have set some text which has some unexpected space and line breaks. This is done just to show the usage of <pre> to display the text as it is −
<pre> This is a demo text and will appear in the same format as it is visible here. The pre tag displays the text in a fixed-width font. It preserves both spaces and line breaks as you can see here. </pre>
Now, since we have used the <pre> tag, the above text will get displayed as it is on the web page by preserving the space and line breaks.
- Related Articles
- HTML Tag
- HTML Tag
- HTML Tag
- HTML Tag
- HTML Tag
- HTML Tag
- HTML Tag
- HTML Tag
- HTML Tag
- HTML Tag
- HTML Tag
- HTML tag
- HTML Tag
- HTML Tag
- HTML Tag

Advertisements