HTML Tag Reference - HTML tag <section>








The <section> element is new to HTML5 and marks a section of a document.

Browser compatibility

<section> Yes Yes Yes Yes Yes

What's new in HTML5

The <section> tag is new in HTML5.

Global Attributes

The <section> tag supports the Global Attributes in HTML.

Event Attributes

The <section> tag supports the Event Attributes in HTML.

Default CSS Settings

section { 
    display: block;
}




Example

A demo showing how to use <section> tag.

<!DOCTYPE HTML> 
<html> 
<head> 
<style> 
section{ <!--  w  w w.ja  v  a  2  s .c o m-->
   background: grey; 
   color: white; 
   font-size: 1em; 
   margin-top: 0px;
} 
</style> 
</head> 
<body> 
    <section> 
        <hgroup> 
            <h1>H1</h1> 
            <h2>H2</h2> 
        </hgroup> 
        <section> 
            <h1>H1 of section</h1> 
            <p>This is a paragraph.</p>
        </section> 
    </section> 
</body> 
</html>

Click to view the demo