Categories
HTML Tutorials

Understanding the need to group content

HTML requires browsers to collapse multiple whitespace characters into a single space. This is generally a useful feature, because it separates the layout of your HTML document from the layout of the content in the browser window.

<html>
   <head>
      <title>Example</title>
      <meta name="author" content="Adam Freeman"/>
      <meta name="description" content="A simple example"/>
      <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
   </head>
   <body>
      I like apples and oranges.
      I also like bananas, mangoes, cherries, apricots, plums, peaches and grapes.
      You can see other fruits I like <a href="fruitlist.html">here</a>.
      <strong>Warning:</strong> Eating too many oranges can give you heartburn.
      My favorite kind of orange is the mandarin, properly known
      as <i>citrus reticulata</i>.
      Oranges at my local store cost <s>$1 each</s> $2 for 3.
      The <abbr title="Florida Department of Citrus">FDOC</abbr> regulates the Florida
      citrus industry.
      I still remember the best apple I ever tasted.
      I bought it at <time datetime="15:00">3 o'clock</time>
      on <time datetime="1984-12-7">December 7th</time>.
   </body>
</html>

The text in the body element spreads over multiple lines. Some of those lines are indented, and there are line breaks between groups of lines. The browser will ignore all of this structure and display all of the content as a single line as shown below.

The elements in the sections that follow will help you add structure to a document by grouping together related regions of content. There are many different approaches to grouping content, from a simple paragraph to sophisticated lists.