Created
December 19, 2016 17:12
-
-
Save neovea/1211c63eca21d43b9e61368296ed5e89 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* { | |
box-sizing: border-box; | |
} | |
html, body { | |
margin: 0; | |
} | |
@mixin animation() { | |
transition-duration: 0.5s; | |
transition-timing-function: cubic-bezier(0.65, 0.05, 0.36, 1); | |
} | |
.button-group{ | |
position: absolute; | |
width: 65px; | |
height: 65px; | |
top: 0; | |
left: 300px; | |
margin: 8px; /* just to give some space*/ | |
@include animation(); | |
} | |
.menu-button { | |
width: 100%; | |
height: 100%; | |
position: absolute; | |
display: block; | |
background-color: #000; | |
text-align: center; | |
color: #fff; | |
border-radius: 50%; | |
left: 0; | |
top: 0; | |
span { | |
display: block; | |
width: 100%; | |
height: 20px; | |
position: absolute; | |
top: 50%; | |
left: 50%; | |
transform: translate(-50%,-50%); | |
@include animation(); | |
.fa-times { | |
display: none; | |
} | |
} | |
&.off { | |
z-index: -1; | |
} | |
} | |
#menu { | |
position: absolute; | |
height: 100vh; | |
width: 300px; | |
margin: 0; | |
background-color: #000; | |
transform: translateX(0); | |
a { | |
color:#fff; | |
font-family: Cutive Mono; | |
text-decoration: none; | |
} | |
@include animation(); | |
&:target { | |
transform: translateX(-100%); | |
+.button-group { | |
left: 0; | |
.menu-button:first-child { | |
span { | |
.fa-times { | |
display: block; | |
} | |
.fa-bars { | |
display: none; | |
} | |
} | |
} | |
.off { | |
z-index: 0; | |
background-color: transparent; | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="fr"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Pure off canvas css menu</title> | |
<link href="https://fonts.googleapis.com/css?family=Cutive+Mono" rel="stylesheet"> | |
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"> | |
<link rel="stylesheet" href="stylesheets/main.css"> | |
</head> | |
<body> | |
<div id="menu"> | |
<ul> | |
<li><a href="">Lorem.</a></li> | |
<li><a href="">Suscipit!</a></li> | |
<li><a href="">Sapiente.</a></li> | |
</ul> | |
</div> | |
<div class="button-group"> | |
<a class="menu-button" href="#menu"> | |
<span> | |
<i class="fa fa-bars" aria-hidden="true"></i> | |
<i class="fa fa-times" aria-hidden="true"></i> | |
</span> | |
</a> | |
<a class="menu-button off" href="#off-menu"></a> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment