Created
March 22, 2012 07:03
-
-
Save alexmwalker/2156775 to your computer and use it in GitHub Desktop.
The first commented line is your dabblet’s title
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
| /** | |
| * The first commented line is your dabblet’s title | |
| */ | |
| /* The large delay prevents the color from changing */ | |
| * { position:relative;} | |
| ol li{ | |
| top:1.2em | |
| } | |
| ol{ list-style:none; | |
| font-size:24px; | |
| outline:1px dashed red; | |
| height:1em; | |
| overflow:hidden} | |
| p.perm {transition: left 0s 4s; | |
| } | |
| /* When a button is pressed, overwrite the transition property | |
| to remove the delay, so that we can instantly change the color */ | |
| .red:hover ~ p.perm, .green:hover ~ p.perm, .blue:hover ~ p.perm, .purple:hover ~ p { | |
| transition: left 0s; | |
| } | |
| .red:hover ~ p { | |
| left: 2em; | |
| } | |
| .green:hover ~ p { | |
| left: 3em; | |
| } | |
| .blue:hover ~ p { | |
| left: 4em; | |
| } | |
| .purple ~ ol li{ | |
| animation-delay:0; | |
| animation: | |
| score1 9s 1 linear; | |
| animation-play-state:running; | |
| } | |
| .purple:hover ~ ol li{ | |
| animation: | |
| score2 9s 1 linear; | |
| animation-delay:10; | |
| animation-play-state:p; | |
| } | |
| @keyframes score1 | |
| { | |
| 0% {background: red;top:1.2em} | |
| 1% {background: yellow;top:0em} | |
| 100% {background: yellow;top:0em} | |
| } | |
| @keyframes score2 | |
| { | |
| 0% {background: green;top:0em} | |
| 1% {background: yellow;top:-1.2em} | |
| 100% {background: yellow;top:-1.2em} | |
| } |
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> --> | |
| <button class="red">Red</button> | |
| <button class="green">Green</button> | |
| <button class="blue">Blue</button> | |
| <p> | |
| This text will only have the color while the button is pressed down. | |
| </p> | |
| <p class="perm"> | |
| This text will keep the given color even after the button is released. | |
| </p> | |
| <button class="purple">Purple</button> | |
| <p> | |
| This text will only have the color while the button is pressed down. | |
| </p> | |
| <ol id="pl1"> | |
| <li>0</li> | |
| <li>1</li> | |
| <li>2</li> | |
| <li>3</li> | |
| <li>4</li> | |
| <li>5</li> | |
| </ol> | |
| <div id="char">sd</div> | |
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":"split","seethrough":"","prefixfree":"1","page":"css"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment