Skip to content

Instantly share code, notes, and snippets.

Created March 18, 2012 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/2076416 to your computer and use it in GitHub Desktop.
Save anonymous/2076416 to your computer and use it in GitHub Desktop.
Untitled
.up, .down, .left, .right {
position: absolute;
margin-top: 100%;
margin-left: 50%;
font-size: 40px;
width: 50px;
height: 50px;
}
.up {
top: -300px;
left: -25px;
}
.down {
top: -200px;
left: -25px;
}
.left {
top: -250px;
left: -75px;
}
.right {
top: -250px;
left: 25px;
}
.up:active ~ .box {
transition: margin-top 2s linear,
margin-left 2s linear;
margin-top: 1px;
}
.down:active ~ .box {
transition: margin-top 2s linear,
margin-left 2s linear;
margin-top: 500px;
}
.left:active ~ .box {
transition: margin-top 2s linear,
margin-left 2s linear;
margin-left: 1px;
}
.right:active ~ .box {
transition: margin-top 2s linear,
margin-left 2s linear;
margin-left: 500px;
}
.box {
width: 100px;
height: 100px;
background:red;
transition-property: margin-top, margin-left;
transition-duration: 0;
transition-delay: 999999s;
transition-timing-function: linear;
}
<button class="up" accesskey="j">&uarr;</button>
<button class="down" accesskey="k">&darr;</button>
<button class="left" >&larr;</buton>
<button class="right">&rarr;</button>
<div class="box"></div>
{"view":"split-vertical","seethrough":"","prefixfree":"1","page":"css"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment