HTML5: Details Element

Source: Internet
Author: User
Tags dojo toolkit

Tutorial details
• Overview: HTML5 Details labels
• Difficulty: elementary
• Supported browsers: Chrome 12 or later versions
My favorite HTML5 new tag is the details element, which has just been integrated into Chrome's latest version 12. I will show you how to use it in today's Quick Start.
________________________________________
What can the Details tag do?
It essentially allows us to display and hide content when clicking a tag. You must be quite familiar with this effect, but until now, it is always implemented using Javascript. Imagine an arrow behind the header. When you click it, the additional information below will be displayed. Click the arrow again to disappear. This function is often used on the FAQ page. The Details element allows us to leave Javascript alone. In other words, it will do this because browser support is still poor. ________________________________________
Example
Now let's dive into and learn how to use this new tag. We start by creating a new details element.


Then, we need to put the contents of summary.
Who Goes to College?
<P> Your mom.

</Details> well, let's start with some more practical examples. I want to use the details element to display different Nettuts + articles. We first create a tag for each article.
<Summary> Dig Into Dojo


<H3> Dig into Dojo: DOM Basics
<P> Maybe you saw that tweet: "jQuery is a gateway drug. it leads to full-on JavaScript usage. "Part of that addiction, I contend, is learning other JavaScript frameworks. and that's what this four-part series on the incredible Dojo Toolkit is all about: taking you to the next level of your JavaScript addiction.
</P>
</Div>
</Details> next, we will add a simple style to it. Body {font-family: sans-serif;} details {
Overflow: hidden;
Background: # e3e3e3;
Margin-bottom: 10px;
Display: block;
} Details summary {
Cursor: pointer;
Padding: 10px;
} Details div {
Float: left;
Width: 65%;
} Details div h3 {margin-top: 0;} details img {
Float: left;
Width: 200px;
Padding: 0 30px 10px 10px;
}

 

Note: For convenience, when the content is displayed. However, when the page is loaded, you will only see the summary text.
If you want to display this status by default, you need to add openattribute to the details element :.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.