Page Nav

HIDE

Grid

GRID_STYLE

Classic Header

{fbt_classic_header}

Latest:

latest

HTML preformatted tag

HTML preformatted tag is used for getting output in a specific format. Between its opening and closing tags keeps the text format same in t...

HTML preformatted tag


HTML preformatted tag is used for getting output in a specific format. Between its opening and closing tags keeps the text format same in the output .

HTML preformatted tag structure


<pre>Contents are here</pre>

Here is examples on preformatted tags

Example 01:

<html>
<head>
<title>Preformatted style</title>
</head>
<body>
<p>In ICC world cup 2019 10 teams are playing.</p>
<pre>
Teams are

    01 England
    02 Australia
    03 South Africa
    04 India
    05 New Zealand
    06 Pakistan
    07 Bangladesh
    08 West Indies
    09 Sri Lanka
    10 Afghanistan
</pre>
</body>
</html>



After saving these Text file with .html extension we have to open this with any web browser. Then we will get output like this-

HTML preformatted tag

Example : 02

<html>
<head>
<title>Preformatted style style</title>
</head>
<body>
<p>Here is student ID and GPA of final exam</p>
<pre>
   Student GPA list

    ID         GPA SECTION
1021         4.0              A
9420         3.8              C
1136         3.5              B
1045 3.0              C
9934         3.7              A


</pre>
</body>
</html>


We will see output in the browser like this

HTML preformatted tag

If we don't use HTML preformatted tag then we will not see as expected formatted style as we want to show.

In the Example 02 if we don't use HTML preformatted tag then we will see web page view like this-

<html>
<head>
<title>Preformatted style style</title>
</head>
<body>
<p>Here is student ID and GPA of final exam</p>

   Student GPA list

   ID          GPA SECTION
1021         4.0              A
9420         3.8              C
1136         3.5              B
1045 3.0              C
9934         3.7              A



</body>
</html>

 HTML page view

HTML preformatted tag

So, as like this using HTML preformatted tag we can set text format as like we want to show.

No comments