pre tags to Maintain Formatting

It is used to display the exact format written in source HTML document. Text written in the opening <pre> tag and the closing </pre> tag preserves its formatting as given in the source document and the white space is preserved. Usually text is displayed in a monospaced font. It is mainly used to show software source code on a webpage as shown

HTML code

<p>Preformatted text of C code follows</p>
<pre>
#include<stdio.h>
void main()
{
printf(“Hello\nSir”);
getch();
}
</pre>

Browser output

The pre Tags to Maintain Formatting

Apply for HTML Certification

https://www.vskills.in/certification/certified-html-designer

Back to Tutorials

Share this post
[social_warfare]
br tag for Line Breaks
b tag for Bold

Get industry recognized certification – Contact us

keyboard_arrow_up