Skip to content

Instantly share code, notes, and snippets.

@tomax
Created March 12, 2013 11:05
Show Gist options
  • Select an option

  • Save tomax/5142051 to your computer and use it in GitHub Desktop.

Select an option

Save tomax/5142051 to your computer and use it in GitHub Desktop.
Using :active state to close menu item
/**
* Using :active state to close menu item
*/
body {
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
position:relative;
}
ul li {
position:relative;
left:-48px;
background-color:white;
transition: 0.8s;
width: 60px;
}
li:hover {
width: 200px;
}
li:active {
width: 60px;
left:-200px;
transition: 0;
}
<!-- content to be placed inside <body>…</body> -->
<ul>
<li><a href="#">some text</a></li>
<li><a href="#">some text</a></li>
<li><a href="#">some text</a></li>
<li><a href="#">some text</a></li>
</ul>
// alert('Hello world!');
{"view":"separate","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