Skip to content

Instantly share code, notes, and snippets.

@JBlackCat
Created February 3, 2014 00:14
Show Gist options
  • Save JBlackCat/8777072 to your computer and use it in GitHub Desktop.
Save JBlackCat/8777072 to your computer and use it in GitHub Desktop.
A Pen by Jesse Black.

Menu icon to Close Icon

I saw something similar to this on another website(I forget which one) and I thought I would take a stab at creating my own.

A Pen by Jesse Black on CodePen.

License.

@import "compass";
//Change to preference
$btn-sq-size:4em;
$color-menu:gray;
$color-close:darkred;
//Don't change variables below
$btn-Line-Width:100%;
$btn-Line-Height:$btn-sq-size/5;
div{ position:relative; box-sizing:border-box; width:$btn-sq-size; height:$btn-sq-size; border-top:$btn-Line-Height solid $color-menu; border-bottom:$btn-Line-Height solid $color-menu; transition:border-color 0.5s;
&:before,&:after{ content:""; display:block; position:absolute; top:$btn-Line-Height; width:$btn-Line-Width; height:$btn-Line-Height; background:$color-menu; transform:rotate(0deg); transition:transform 0.5s; }
&:hover{border-color:transparent;
&:before,&:after{ background-color:$color-close; }
&:before{ transform:rotate(45deg); }
&:after{ transform:rotate(-45deg); }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment