<section> - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:section

Introduction

The section element is new to HTML5.

It marks a section of a document.

The section element contains 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.

The section Element summary

Item Value
Element: section
Permitted Parents: The section element cannot be a child of the address element.
Local Attributes: None
Contents: style elements and flow content.
Tag Style: Start and end tags
New in HTML5? Yes
Changes in HTML5 N/A

Style Convention

section {
  display: block;
}

The following code shows the section element in use.

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
   <head> 
      <title>Example</title> 
      <style>
h1, h2, h3 {<!-- w  ww  . ja v  a  2s .  co m-->
   background: grey;
   color: white;
}
hgroup > h1 {
   margin-bottom: 0px;
}
hgroup > h2 {
   background: grey;
   color: white;
   font-size: 1em;
   margin-top: 0px;
}

      </style> 
   </head> 
   <body> 
      <section> 
         <section> 
            <h1>HTML</h1>
             details 
            <section> 
               <h1>Introduction</h1>
                more details. 
            </section> 
         </section> 
      </section>  
   </body>
</html>

Related Tutorials