The basic web page: Paragraphs and Headlines

  1. HTML and BODY
  2. The basic web page
  3. The HEAD of the document

If you go and view the page in your browser, it’s still just a mass of text. We’ve told the browser where the document is, but we still haven’t given it any structure. Let’s set up one headline, one paragraph, and one quote. These are the first three lines of the review.

<h1>Review: Carnival of Souls</h1>

<p>Reviewed by Jerry Stratton, May 31, 2009</p>

<blockquote><p>“If she is a magnet for the gothic, there is nothing exciting or sexy about it. The thrills of this carnival are cold ones, bits of death.”</p></blockquote>

The tag name for the headline is “h1”. The tag name for a generic paragraph is “p”. And the tag name for a section of quoting is “blockquote”.

image 3

It’s already beginning to look quite a bit better. The HTML tags tell the browser what each bit of text is; the browser then displays that text more appropriately. Take a good look, for example, at the blockquote section. In the text, just as in the image above, the blockquote is on two lines. But they’re not the same two lines. The web browser is ignoring the line breaks in the document; if you left in all of the extra spaces, the web browser ignores those, too. Line breaks and spaces are called “white space”, and web browsers are required to collapse all white space so that it doesn’t matter where the original document has line breaks, where it has indentation, or where there are multiple spaces in a row.

The only thing the web browser cares about is the location of the HTML tags.

  1. HTML and BODY
  2. The basic web page
  3. The HEAD of the document