Skip to content

Instantly share code, notes, and snippets.

@GeorgeTzellis
Created July 23, 2012 16:06
Show Gist options
  • Save GeorgeTzellis/3164428 to your computer and use it in GitHub Desktop.
Save GeorgeTzellis/3164428 to your computer and use it in GitHub Desktop.
width: auto to 0 = line-height transition: 1 to 0
/* width: auto to 0 = line-height transition: 1 to 0 */
div {
display:block;
width: 100px;
line-height: 0;
color: transparent;
background: #ff0;
transition: all 1s ease-in-out;
}
.animated {
line-height: 1.5;
color: black;
background: gold;
}div:first-line {
color: red;
background-color: green;
}
div.animated:first-line {
clear:both;
float:right;
color: green;
background-color: red;}
div:first-letter {
float:right;
color: green;
background-color: red;
}
div.animated:first-letter {
float:left;font-size:2em;
padding:0.2em;
color: red;
background-color: green;
text-shadow:0 -1px white}
section{
display:block;
transition: all 10s ease-in;
}
<section>
<div id="Toggle">
There once was a box that wanted a transition
</div><button
onclick="this.previousSibling.className=this.previousSibling.className=='animated'?'':'animated'">
Click me</button></section>
{"view":"split-vertical","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