Skip to content

Instantly share code, notes, and snippets.

@gentle-media
Created April 20, 2012 13:38
Show Gist options
  • Save gentle-media/2428633 to your computer and use it in GitHub Desktop.
Save gentle-media/2428633 to your computer and use it in GitHub Desktop.
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
/* The large delay prevents the color from changing */
p.perm {
transition: color 0s 9999999s;
}
/* When a button is pressed, overwrite the transition property
to remove the delay, so that we can instantly change the color */
a.red:hover ~ p.perm, a.green:hover ~ p.perm, a.blue:hover ~ p.perm {
transition: color 0s 2s;
}
a.red:hover ~ p {
color: red;
}
a.green:hover ~ p {
color: green;
}
a.blue:hover ~ p {
color: blue;
}
<a href="#" class="red">Red</a>
<a href="#" class="green">Green</a>
<a href="#" class="blue">Blue<a>
<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>
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"css"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment