Is it possible to create a CSS-only accordion?

2019-02-27 09:31发布

问题:

I'm thinking about using an accordion in a "please enable Javascript" page, but I don't know if it's possible with CSS only.

I'm almost sure it is for most browsers, but I'm also fearing I'll face some limitation of IE and I'd like to know if any of you tried this already (or not) and could tell me if it's either possible or impossible (considering IE6+).

回答1:

Some CSS only Accordin here

http://www.webdeveloperjuice.com/2010/05/17/8-powerful-pure-css-accordions-to-make-web-application-lite-and-impressive/

And it is IE 6 compatible

http://www.cssnewbie.com/advanced-css-accordion-effect/

http://www.cssnewbie.com/example/css-only-accordion/vertical.html



回答2:

It is impossible without JavaScript. Even if you use the new HTML5 transitions (which are certainly not supported in IE6), you still need JavaScript to trigger the transition.