SARKARIRESULTUP.COM

Home New Blog Technology Food & Recipe Travel Test Education

How to Show text written as is it in HTML

Written by Kamlesh, Updated on March 18, 2020
Language, Coding

The pre tag in HTML is used to define the block of preformatted text which preserves the text spaces, line breaks, tabs, and other formatting characters which are ignored by web browsers. Text in the pre element is displayed in a fixed-width font, but it can be changed using CSS.

Example of showing content in HTML without formatting.


                        

pre { display: block; font-family: monospace; white-space: pre; margin: 1em 0; }

Using pre tag element, we can display text with space, tab, enter in html page. < pre> element does not remove the space, tab, enter from the html page, it shows the user-written as it is.