Whitespace in HTML Documents

1. Examine the  HTML Document below then follow this link to see what the document looks like in a browser.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 l//EN">
<HTML>

<HEAD>
<TITLE>Simple HTML page.</TITLE>
</HEAD>

<BODY>
      Hello Students!

           Welcome to CSC 263 - Introduction to HTML

          How do you like my web page? It's nothing special yet but
      at least it's a start. By the time this course is over you will
      be creating Really Cool Web Pages!

           Hope you all receive an "A" in this course.

                            Linda M. Hicks
</BODY>
</HTML>

2.  Displaying White Space in your document.  View this document in a browser.

So what do you do when you want the browser to display all spaces, tabs and white space in your document?    Use the <PRE> </PRE> preformatted text tags.  Your text will be presented in a monospaced font such as Courier.

<HTML>
<HEAD>
<TITLE>Using the PRE tag.</TITLE>

<BODY>
<PRE>
    Linda M. Hicks                  office: room 213D MSB
    Lecturer in Computer Science    email: hickslm@umich.edu 
    University of Michigan-Flint    phone: (810) 762-3184
    Flint, MI 48502                 fax: (810) 762-3469
</PRE> 
</BODY>
</HTML>   

3.  In displaying your html page, browsers ignor whitespace, that is tabs, more than one blank space or a return character entered by a text editor. Use the <PRE> tags or these special tags  for spacing  in your HTML documents:  

  • blank space:  &nbsp;
  • new paragraph:  <P>      </P>
  • line break:  <BR> 

  

     

Last updated on 01/02/2004  by L.M. Hicks