Skip to content

Instantly share code, notes, and snippets.

@gadgetto
Created February 23, 2012 16:39
Show Gist options
  • Save gadgetto/1893667 to your computer and use it in GitHub Desktop.
Save gadgetto/1893667 to your computer and use it in GitHub Desktop.
Dual color changing link by CSS3 transition
/**
* Dual color changing link by CSS3 transition
*/
h1 { /* only for decoration */
background-color: #2d2d2d;
padding: 30px;
text-align: center;
font-family: sans-serif;
}
h1 a,
h1 a:link,
h1 a:visited {
color: #fff;
text-decoration: none;
transition: color 0.5s linear;
}
h1 a:hover {
color: #9ec41a;
text-decoration: none;
}
h1 a span,
h1 a:link span,
h1 a:visited span {
color: #9ec41a;
transition: color 0.5s linear;
}
h1 a:hover span {
color: #fff;
text-decoration: none;
}
<!-- content to be placed inside <body>…</body> -->
<h1><a href="#"><span>Left changes color</span> with right part</a></h1>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment