Created
April 12, 2012 16:33
-
-
Save barraponto/2368909 to your computer and use it in GitHub Desktop.
pure css accordion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * pure css accordion | |
| */ | |
| body { width: 240px; } | |
| ul { padding: 0; margin: 0; } | |
| h2 { margin-top: 0; margin-bottom: 0.25em; } | |
| h2 a { text-decoration: none; color: #905; } | |
| li p { transition: height 1.5s; height: 0; overflow: hidden; margin: 0; } | |
| li:target p { height: 81px; } | |
| /* unfortunatelly, I can't use height: auto; | |
| /* because it is not supported by css transitions yet. | |
| /* see http://oli.jp/2010/css-animatable-properties/ */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- content to be placed inside <body>…</body> --> | |
| <ul> | |
| <li id="a"><h2><a href="#a">click me!</a></h2><p>this is filler text. this is filler text. this is filler text. this is filler text. this is filler text. this is filler text. this is filler text. this is filler text. this is filler text.</p></li> | |
| <li id="b"><h2><a href="#b">no, click me!</a></h2><p>this is filler text. this is filler text. this is filler text. this is filler text. this is filler text. this is filler text. this is filler text. this is filler text. this is filler text.</p></li> | |
| <li id="c"><h2><a href="#c">click me, i tell you!</a></h2><p>this is filler text. this is filler text. this is filler text. this is filler text. this is filler text. this is filler text. this is filler text. this is filler text. this is filler text.</p></li> | |
| </ul> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {"view":"separate","seethrough":"","prefixfree":"1","page":"all"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment