css 动画汉堡包图标
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了css 动画汉堡包图标相关的知识,希望对你有一定的参考价值。
/* Hamburger Icon */
#mobile-toggle {
width: 50px;
height: 45px;
position: relative;
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg);
-webkit-transition: .5s ease-in-out;
-moz-transition: .5s ease-in-out;
-o-transition: .5s ease-in-out;
transition: .5s ease-in-out;
cursor: pointer;
}
#mobile-toggle span {
display: block;
position: absolute;
height: 4px;
width: 100%;
background: #2e3389;
border-radius: 4px;
opacity: 1;
left: 0;
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-ms-transform: rotate(0deg);
transform: rotate(0deg);
-webkit-transition: .25s ease-in-out;
-moz-transition: .25s ease-in-out;
-ms-transition: .25s ease-in-out;
transition: .25s ease-in-out;
}
#mobile-toggle span:nth-child(1) {
top: 0px;
}
#mobile-toggle span:nth-child(2),#mobile-toggle span:nth-child(3) {
top: 16px;
}
#mobile-toggle span:nth-child(4) {
top: 34px;
}
#mobile-toggle.active span:nth-child(1) {
top: 18px;
width: 0%;
left: 50%;
}
#mobile-toggle.active span:nth-child(2) {
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
#mobile-toggle.active span:nth-child(3) {
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
transform: rotate(-45deg);
}
#mobile-toggle.active span:nth-child(4) {
top: 18px;
width: 0%;
left: 50%;
}
以上是关于css 动画汉堡包图标的主要内容,如果未能解决你的问题,请参考以下文章
css 在汉堡包图标后添加“菜单”文字
css 图标转换汉堡包到X关闭
css 引导汉堡包动画
css bootstrap动画汉堡包
css 引导汉堡包动画
css bootstrap动画汉堡包