.MenuContainer
input.HiddenCheckbox#menu(type="checkbox", name="menu")
label.MenuIcon(for="menu")
h2.MenuHeader Profile Menu
nav.Menu
ul.Menu-list
li.Menu-item: a.Menu-link(href="https://codepen.io/rthor", target="_blank") Visit Profile
li.Menu-item: a.Menu-link(href="http://rthor.is", target="_blank") Read Blog
li.Menu-item: a.Menu-link(href="https://github.com/rthor", target="_blank") Checkout Code
View Compiled
@size-MenuIcon: 30px;
@width-MenuIcon: 6px;
@color-MenuIcon: #999;
.HiddenCheckbox {
display: none;
}
.MenuContainer {
display: inline-block;
margin: 20px;
}
.MenuHeader {
color: @color-MenuIcon;
display: inline-block;
float: left;
font-weight: 100;
line-height: @size-MenuIcon;
margin: 0 0 0 @size-MenuIcon / 2;
opacity: 0;
position: relative;
transform: translate3d(0, -@size-MenuIcon / 2, 0);
transition: transform 0.6s, opacity 0.5s;
z-index: 2;
}
.MenuIcon {
cursor: pointer;
display: block;
float: left;
height: @size-MenuIcon;
position: relative;
width: @size-MenuIcon;
z-index: 2;
&::before {
box-shadow: @color-MenuIcon 0 (@width-MenuIcon * 2) 0;
height: @width-MenuIcon;
transform-origin: left top;
width: @size-MenuIcon;
}
&::after {
bottom: 0;
height: @width-MenuIcon;
transform-origin: left bottom;
width: @size-MenuIcon;
}
}
.MenuIcon::before,
.MenuIcon::after {
background: @color-MenuIcon;
display: block;
content: '';
position: absolute;
transition: box-shadow 0.2s linear, transform 0.4s 0.2s;
}
.Menu {
background: #333;
bottom: 0;
left: -90%;
position: absolute;
top: 0;
width: 90%;
transition: left 0.4s;
}
.HiddenCheckbox:checked ~ .MenuHeader {
opacity: 1;
transform: none;
}
.HiddenCheckbox:checked ~ .MenuIcon {
&::before {
box-shadow: transparent 0 0 0;
transform: rotate(45deg) translate3d(@width-MenuIcon, -@width-MenuIcon / 2, 0);
}
&::after {
transform: rotate(-45deg) translate3d(@width-MenuIcon, @width-MenuIcon / 2, 0);
}
}
.HiddenCheckbox:checked ~ .Menu {
left: 0;
}
.Menu-list {
list-style-type: none;
margin: @size-MenuIcon + 30px 0 0;
padding: 0;
}
.Menu-item {
margin: 0;
}
.Menu-link {
color: #fff;
display: block;
overflow: hidden;
padding: 8px 22px;
position: relative;
text-decoration: none;
z-index: 1;
&::before {
background: #444;
bottom: 0;
content: '';
left: 0;
position: absolute;
right: 100%;
top: 0;
transition: right 0.4s;
z-index: -1;
}
&::after {
content: attr(href);
color: #fff;
float: right;
opacity: 0;
transition: opacity 0.8s, transform 0.4s;
transform: translate3d(100%, 0, 0);
}
&:hover::before {
right: 0;
}
&:hover::after {
opacity: 0.5;
transform: translate3d(0, 0, 0);
}
}
View Compiled
This Pen doesn't use any external CSS resources.