Creating Sections with section element

Description

The section element is new to HTML5 and denotes a section of a document.

The section element should be used to contain content that would be listed in a document's outline or table of contents.

Section elements usually contain of one or more paragraphs of content and a heading, although the heading is optional.

Example

The following code shows the section element in use.


<!DOCTYPE HTML>
<html>
<head>
</head><!-- w w  w  . j av  a  2 s  . c  o m-->
<body>
  <section>
    <hgroup>
      <h1>H1</h1>
      <h2>H2</h2>
    </hgroup>
    This is a test.
    <section>
      <h1>H1</h1>
      This is a test.
      <section>
        <h1>More information</h1>
        This is a test.
      </section>
    </section>
  </section>
</body>
</html>

Click to view the demo





















Home »
  HTML CSS »
    HTML »




HTML Introduction
HTML Document
HTML Section
HTML Group Content
HTML Text Marker
HTML Table
HTML Form
HTML Embed