Skip to content

Instantly share code, notes, and snippets.

@alexmwalker
Created March 24, 2012 09:22
Show Gist options
  • Select an option

  • Save alexmwalker/2180562 to your computer and use it in GitHub Desktop.

Select an option

Save alexmwalker/2180562 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
*/
body{
background:#000;
color:#fff;
}
ol{position:relative}
li{
width:100px;height:100px;
list-style-position:inside;
font-size:90px;
text-indent:.3em;
background:#333;
position:absolute;
border:1px solid white;
transition: left 3s ease 0s;
left:1em
}
li:hover{
left:-99em;
transition: left 3s ease 0s;
}
#target{
background:red;
width:100%;
height:1em;
display:block;
}
#ball{
position:absolute;
width:20px;
height:20px;
display:block;
background:#3f3;
border-radius:50%;
box-shadow:0px 0px 7px rgba(90,255,90,.9), 0px 0px 7px rgba(90,255,90,.9);
transform: translate(0px,0px);
animation:
updown 4s 1,
leftright 6s infinite 8s;
animation-play-state:paused;
}
/*
#target:hover ~ #ball{
animation-play-state:running
}
#target ~ ol li:nth-child(1),#target ~ ol li:nth-child(2),#target ~ ol li:nth-child(3){
animation:leftright 99s infinite;
animation-play-state:paused
}
#target:hover ~ ol li:nth-child(1),#target:hover ~ ol li:nth-child(2),#target:hover ~ ol li:nth-child(3){
animation-play-state:running
}
@keyframes updown{
0%,100% {transform: translatey(0px)}
2% {transform: translatey(130px)}
}
@keyframes leftright{
0% {transform: translatex(0px)}
2% {transform: translatex(380px)}
100% {transform: translatex(380px)}
}
*/
<!-- content to be placed inside <body>…</body> -->
<h1>CSS3 PONG</h1>
<div id="court">
<div id="horizontal">
<span id="target"></span>
<span id="ball"></span>
<span id="player2"></span>
<ol>
<li></li>
<li></li>
<li></li>
</ol>
</div>
</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