Created
November 28, 2012 00:32
-
-
Save FrnandMG/4158177 to your computer and use it in GitHub Desktop.
A CodePen by fernandomgross. Responsive Menu - Part of my [Responsive Menu Concepts](http://css-tricks.com/responsive-menu-concepts) article on CSS-Tricks. with border-radius on hover
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
<input type="checkbox" id="menu"> | |
<label for="menu" onclick></label> | |
<nav role="off-canvas"> | |
<ul> | |
<li><a href="#">Stream</a></li> | |
<li><a href="#">Lab</a></li> | |
<li><a href="#">Projects</a></li> | |
<li><a href="#">About</a></li> | |
<li><a href="#">Contact</a></li> | |
</ul> | |
</nav> |
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
/** | |
Off Canvas | |
# What? # | |
Part of my "Responsive Menu Concepts" article on CSS-Tricks | |
http://css-tricks.com/responsive-menu-concepts | |
# 2012 by Tim Pietrusky | |
# timpietrusky.com | |
**/ |
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
@import "compass"; | |
@import url(http://fonts.googleapis.com/css?family=Open+Sans:400,600,700); | |
* { | |
box-sizing:border-box; | |
} | |
html, | |
body { | |
width:100%; | |
height:100%; | |
} | |
body { | |
margin:.55em; | |
color: rgb(0, 0, 0); | |
background: url(http://subtlepatterns.subtlepatterns.netdna-cdn.com/patterns/shattered.png); | |
} | |
/* custom scrollbar */ | |
::-webkit-scrollbar { | |
width: .95em; | |
} | |
::-webkit-scrollbar-track { | |
background-color: rgba(217, 217, 217, .5); | |
} | |
::-webkit-scrollbar-thumb { | |
background: rgba(184, 184, 184, .5); | |
box-shadow: | |
inset .05em .05em 0 rgba(0, 0, 0, .1), | |
inset 0 -.05em 0 rgba(0, 0, 0, .07) | |
; | |
} | |
/* Advanced Checkbox Hack */ | |
body { -webkit-animation: bugfix infinite 1s; } | |
@-webkit-keyframes bugfix { from {padding:0;} to {padding:0;} } | |
input[type=checkbox] { | |
position: absolute; | |
top: -9999px; | |
left: -9999px; | |
} | |
label { | |
position: absolute; | |
left:0; | |
display:none; | |
width:2em; | |
height:2.25em; | |
padding:.35em; | |
font-size:1.1em; | |
color:#fff; | |
transition:color .3s ease-in-out; | |
cursor: pointer; | |
user-select:none; | |
margin:0; | |
background:rgba(0, 0, 0, .4); | |
} | |
/* big screens */ | |
nav[role="off-canvas"] { | |
position:relative; | |
width: 60em; | |
margin: 0 auto; | |
transition-duration: .3s, .5s; | |
transition-timing-function: ease-in-out; | |
transition-property: left, opacity, box-shadow; | |
a { | |
color:#000; | |
text-decoration:none; | |
font: 1.4em 'Open Sans', sans-serif; | |
transition:color .3s ease-in-out; | |
display:table-cell; | |
vertical-align: middle; | |
} | |
ul { | |
padding: 0; | |
margin: 0 auto; | |
width:100%; | |
> li { | |
float:left; | |
padding:.55em .55em; | |
width:8em; | |
height:8em; | |
margin:1.250em; | |
opacity:.8; | |
text-transform:uppercase; | |
display: table; | |
background:hsla(11, 94%, 50%, .65); | |
cursor: pointer; | |
text-align:center; | |
transition-duration: .3s; | |
transition-timing-function: ease-in-out; | |
transition-property: box-shadow, color, opacity, padding-left; | |
cursor: pointer; | |
transform: rotate(45deg); | |
&:hover { | |
color:#000; | |
opacity:1; | |
box-shadow:0 0 0 .5em rgba(255, 255, 255, .95); | |
border-radius:4em; | |
> a { | |
color:#fff; | |
transform: rotate(-45deg); | |
} | |
} | |
&:nth-child(2) { | |
background:hsla(44, 94%, 50%, .65); | |
} | |
&:nth-child(3) { | |
background:hsla(114, 94%, 50%, .65); | |
} | |
&:nth-child(4) { | |
background:hsla(184, 94%, 50%, .65); | |
} | |
&:nth-child(5) { | |
background:hsla(224, 94%, 50%, .65); | |
} | |
} | |
} | |
} | |
/* small screens */ | |
@media screen and (max-width: 44em) { | |
$menu_width: 20em; | |
$content_offset : .5em; | |
html, | |
body { | |
margin:0; | |
overflow-x:hidden; | |
} | |
.content { | |
margin:2.5em .5em 0 .5em; | |
} | |
nav[role="off-canvas"] { | |
position:absolute; | |
top:3em; | |
left:-$menu_width; | |
width: $menu_width; | |
opacity:0; | |
ul > li { | |
height:100%; | |
width:100%; | |
text-align:left; | |
margin:0; | |
&:hover { | |
box-shadow:inset 0 0 0 .15em rgba(255, 255, 255, .45); | |
} | |
} | |
} | |
label { | |
display:block; | |
} | |
label:after { | |
position: absolute; | |
right: .25em; | |
top: 0; | |
content:"\2261"; | |
font-size:1.8em; | |
} | |
label:hover, | |
input:checked ~ label { | |
color:#000; | |
} | |
input:checked ~ nav[role="off-canvas"] { | |
opacity:1; | |
left:0; | |
box-shadow:-30em 0 0 30em rgba(0, 0, 0, .3); | |
ul > li { | |
padding: .55em .55em .55em 1.5em; | |
&:hover { | |
padding-left:3.5em; | |
} | |
&:after { | |
position:absolute; | |
right:.25em; | |
content:"\203A"; | |
font: bold 1.4em sans-serif; | |
color:inherit; | |
} | |
} | |
} | |
input:checked ~ .content { | |
margin-left: $menu_width + $content_offset; | |
margin-right:-($menu_width + $content_offset); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment