<details> - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:details

Introduction

The details element marks a section of the document that the user can expand to get further details about a topic.

The details Element summary

Item Value
Element: details
Element Type: Flow
Permitted Parents: Any element that can contain flow elements
Local Attributes: open
Contents: An (optional) summary element and flow content
Tag Style: Start and end tags
New in HTML5?Yes
Changes in HTML5 N/A
Style Convention details { display: block; }

Using the summary and details Elements

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
   <head> 
      <title>Example</title> 
      <style>
article {border: thin black solid; padding: 10px; margin-bottom: 5px}
details {border: solid thin black; padding: 5px}
details > summary { font-weight: bold}

      </style> 
   </head> 
   <body> 
      <article> 
         <header> 
            <hgroup> 
               <h1 id="">CSS</h1> 
               <h2>Layout</h2> 
            </hgroup> 
         </header> 
         <section> 
            <p>test.</p> 
            <details> 
               <summary>summary</summary>
                this is a test with 
               <ol> 
                  <li>Layout</li> 
                  <li>Color</li> 
                  <li>Width</li> 
               </ol> 
            </details> 
         </section> 
      </article>  
   </body><!--from ww w.jav a 2  s .  c o  m-->
</html>

Related Tutorials