pre tags to Maintain Formatting

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

br-Tag for Line Breaks
Font Styling Tags

Get industry recognized certification – Contact us

keyboard_arrow_up
Open chat
Need help?
Hello 👋
Can we help you?