Re: Thoughts on implementing the HTML5 <details> element with pure CSS

On Apr 7, 2010, at 12:16 AM, Andrew Fedoniouk wrote:

> Below is "pure" CSS solution of such expanding/collapsing element.
> CSS should have following features in order it to work :
> 
> 1) behavior: checkbox;  - this declares the DOM element to behave as
>      checkbox - click on the element simply switches :checked state on and off
>      on that element.

During the face-to-face, I learned from Anne (assuming I understood correctly, which is sometimes a leap of faith) that a feature of HTML5 is that the attribute values are live, so you can have a selector like this: input[type=checkbox][checked], and it would only apply when the checkbox was checked, and not just looking at its checked state during load time. I'm not sure if any UAs do this now. But, I think it means you can do this for the 'details' element:

details[open] { /* only applies when the details box is open */ }

Received on Wednesday, 7 April 2010 14:07:41 UTC