Skip to content

Instantly share code, notes, and snippets.

@minitech
Created July 17, 2012 21:14
Show Gist options
  • Save minitech/3132160 to your computer and use it in GitHub Desktop.
Save minitech/3132160 to your computer and use it in GitHub Desktop.
A functional door.
/**
* A functional door.
*/
#wall {
background-color: #eee;
bottom: 0;
left: 0;
position: absolute;
right: 0;
top: 0;
transform: rotateX(-10deg);
transform-origin: 0 100%;
transform-style: preserve-3d;
}
#door-container {
background-color: black;
height: 100%;
margin: 0 auto;
width: 300px;
}
#door {
background-color: brown;
height: 100%;
margin: auto;
position: relative;
transform-origin: 0 0;
transition: transform 0.5s ease;
width: 300px;
}
#door .knob {
background-color: gold;
border-radius: 10px;
height: 20px;
margin-top: -10px;
position: absolute;
right: 10px;
top: 50%;
width: 20px;
}
#open:target + #wall #door {
transform: rotateY(-145deg);
}
#open:target + #wall #open-link {
display: none;
}
#close-link {
display: none;
}
#open:target + #wall #close-link {
display: inline;
}
<span id="open"></span>
<div id="wall">
<div id="door-container">
<div id="door">
<a href="#open" id="open-link" class="knob"></a>
<a href="#closed" id="close-link" class="knob"></a>
</div>
</div>
</div>
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment