css实现三维立体菜单和页面过渡切换动画效果代码
代码语言:html
所属分类:菜单导航
代码描述:css实现三维立体菜单和页面过渡切换动画效果代码,点击菜单可切换不同的页面。
代码标签: css 三维 立体 菜单 页面 过渡 切换 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> body { margin: 0; padding: 0; background-color: rgb(25, 25, 25); color: white; font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif; } h1 { color: cyan; } p { color: darkcyan; } /*-- MENU --*/ /*-- MENU --*/ /*-- MENU --*/ #menu_label { position: absolute; top: 0; left: 0; width: 50px; height: 50px; z-index: 90000; cursor: pointer; text-align: center; font-size: 30px; line-height: 50px; color: rgba(0, 255, 255, .5); -webkit-transition: all .5s cubic-bezier(0, .5, .25, 1); -moz-transition: all .5s cubic-bezier(0, .5, .25, 1); transition: all .5s cubic-bezier(0, .5, .25, 1); } #menu_label:hover { color: cyan; text-shadow: 0px 0px 10px cyan; } #menu_container { position: absolute; top: 125px; left: -300px; width: 200px; height: 350px; background-color: rgb(0, 90, 90); opacity: 0; box-shadow: -10px 30px 10px 1px rgba(0, 0, 0, .5); z-index: 99999; -webkit-transform: skewY(-10deg); -moz-transform: skewY(-10deg); transform: skewY(-10deg); -webkit-transition: all .5s cubic-bezier(0, .5, .25, 1); -moz-transition: all .5s cubic-bezier(0, .5, .25, 1); transition: all .5s cubic-bezier(0, .5, .25, 1); } #menu_container::before { content: ""; position: absolute; top: -14px; left: -7px; width: 100%; height: 4%; background-color: rgb(0, 110, 110); z-index: 99999; -webkit-transform: skewX(45deg); -moz-transform: skewX(45deg); transform: skewX(45deg); } #menu_container::after { content: ""; position: absolute; top: -7px; left: -14px; width: 7%; height: 100%; background-color: rgb(0, 70, 70); z-index: 99999; -webkit-transform: skewY(45deg); -moz-transform: skewY(45deg); transform: skewY(45deg); } #menu_header { width: 100%; height: 60px; margin-top: -10px; margin-left: -100px; margin-bottom: 5px; box-shadow: -5px -5px 5px 0px rgba(0, 0, 0, .5); opacity: 0; color: rgba(0, 255, 255, .6); text-align: center; line-height: 60px; background: -webkit-linear-gradient(rgba(0, 139, 139, .5), rgba(0, 0, 0, .6)); background: -moz-linear-gradient(rgba(0, 139, 139, .5), rgba(0, 0, 0, .6)); background: linear-gradient(rgba(0, 139, 139, .5), rgba(0, 0, 0, .6)); -webkit-transform: translateX(5px) translateY(5px); -moz-transform: translateX(5px) translateY(5px); transform: translateX(5px) translateY(5px); -webkit-transition: all .5s ease-out; -moz-transition: all .5s ease-out; transition: all .5s ease-out; } #menu_links a { text-decoration: none; display: block; width: 100%; height: 40px; margin-left: -100px; margin-bottom: 9px; background-color: rgba(0, 0, 0, .5); box-shadow: -5px -5px 5px 0px rgba(0, 0, 0, .5); border-left: solid thin rgba(0, 139, 139, .25); opacity: 0; color: rgba(0, 255, 255, .6); line-height: 40px; text-indent: 5px; -webkit-transform: translateX(5px) translateY(5px); -moz-transform: translateX(5px) translateY(5px); transform: translateX(5px) translateY(5px); -webkit-transition: all .5s ease-in; -moz-transition: all .5s ease-in; transition: all .5s ease-in; } #menu_links a:hover { color: cyan; text-indent: 10px; background-color: rgba(0, 0, 0, .65); box-shadow: -10px -5px 5px 0px rgba(0, 0, 0, .5); border-left: solid thin cyan; -webkit-transform: translateX(10px) translateY(10px); -moz-transform: translateX(10px) translateY(10px); transform: translateX(10px) translateY(10px); -webkit-transition: all .25s ease-out; -moz-transition: all .25s ease-out; transition: all .25s ease-out; } #menu_checkbox { display: none; } #menu_checkbox:checked ~ #menu_container { top: 50px; left: 75px; opacity: 1; } #menu_checkbox:checked ~ #menu_container > #menu_header { opacity: 1; margin-left: 0; } #menu_checkbox:checked ~ #menu_container > #menu_links a { opacity: 1; margin-left: 0; } @media (max-width: 700px) { #menu_container { width: 100px; } #menu_checkbox:checked ~ #menu_container { top: 50px; left: 25px; opacity: 1; } #menu_container::after { content: ""; position: absolute; top: -7px; left: -14px; width: 14%; height: 100%; background-color: rgb(0, 70, 70); z-index: 99999; -webkit-transform: skewY(45deg); -moz-transform: skewY(45deg); transform: skewY(45deg); } } /*-- MENU --*/ /*-- MENU --*/ /*-- MENU --*/ #home { position: absolute; top: 0; left: 5%; display: block; width: 90%; height: 0px; margin-top: 110px; background: -webkit-linear-gradient(rgb(40, 40, 40), rgb(60, 60, 60)); background: -moz-linear-gradient(rgb(40, 40, 40), rgb(60, 60, 60)); background: linear-gradient(rgb(40, 40, 40), rgb(60, 60, 60)); opacity: 0; z-index: -99999; text-align: center; -webkit-transform: skewY(-10deg); -moz-transform: skewY(-10deg); transform: skewY(-10deg); -webkit-transition: all .5s cubic-bezier(0, .5, .25, 1); -moz-transition: all .5s cubic-bezier(0, .5, .25, 1); transition: all .5s cubic-bezier(0, .5, .25, 1); } #home::before { content: ""; position: absolute; top: -21px; left: -10px; width: 100%; height: 4%; background-color: rgb(70, 70, 70); z-index: 99999; -webkit-transform: skewX(45deg); -moz-transform: skewX(45deg); transform: skewX(45deg); } #home::after { content: ""; position: absolute; top: -10px; left: -21px; width: 20px; height: 100%; background: -webkit-linear-gradient(rgb(30, 30, 30), rgb(50, 50, 50)); background: -moz-linear-gradient(rgb(30, 30, 30), rgb(50, 50, 50)); background: linear-gradient(rgb(30, 30, 30), rgb(50, 50, 50)); z-index: 99999; -webkit-transform: skewY(45deg); -moz-transform: skewY(45deg); transform: skewY(45deg); } #home:target { height: 500px; opacity: 1; -webkit-transition-delay: .25s; -moz-transition-delay: .25s; transition-delay: .25s; } #home h1 { margin-left: -50px; opacity: 0; -webkit-transition: all .5s cubic-bezier(0, .5, .25, 1); -moz-transition: all .5s cubic-bezier(0, .5, .25, 1); transition: all .5s cubic-bezier(0, .5, .25, 1); } #home:target h1 { margin-left: 0; opacity: 1; -webkit-transition-delay: .4s; -moz-transition-delay: .4s; transition-delay: .4s; } #home p { margin-left: -50px; opacity: 0; -webkit-transition: all .5s cubic-bezier(0, .5, .25, 1); -moz-transition: all .5s cubic-bezier(0, .5, .25, 1); transition: all .5s cubic-bezier(0, .5, .25, 1); } #home:target p { margin-left: 0; opacity: 1; -webkit-transition-delay: .5s; -moz-transition-delay: .5s; transition-delay: .5s; } #link_1 { position: absolute; top: 0; left: 5%; display: block; width: 90%; height: 0px; margin-top: 110px; background: -webkit-linear-gradient(rgb(40, 40, 40), rgb(60, 60, 60)); background: -moz-linear-gradient(rgb(40, 40, 40), rgb(60, 60, 60)); background: linear-gradient(rgb(40, 40, 40), rgb(60, 60, 60)); opacity: 0; z-index: -99999; text-align: center; -webkit-transform: skewY(-10deg); -moz-transform: skewY(-10deg); transform: skewY(-10deg); -webkit-transition: all .5s cubic-bezier(0, .5, .25, 1); -moz-transition: all .5s cubic-bezier(0, .5, .25, 1); transition: all .5s cubic-bezier(0, .5, .25, 1); } #link_1::before { content: ""; position: absolute; top: -21px; left: -10px; width: 100%; height: 4%; background-color: rgb(70, 70, 70); z-index: 99999; -webkit-transform: skewX(45deg); -moz-transform: skewX(45deg); transform: skewX(45deg); } #link_1::after { content: ""; position: absolute; top: -10px; left: -21px; width: 20px; height: 100%; background: -webkit-linear-gradient(rgb(30, 30, 30), rgb(50, 50, 50)); background: -moz-linear-gradient(rgb(30, 30, 30), rgb(50, 50, 50)); background: linear-gradient(rgb(30, 30, 30), rgb(50, 50, 50)); z-index: 99999; -webkit-transform: skewY(45deg); -moz-transform: skewY(45deg); transform: skewY(45deg); } #link_1:target { height: 500px; opacity: 1; -webkit-transition-delay: .25s; -moz-transition-delay: .25s; transition-delay: .25s; } #link_1 h1 { margin-left: -50px; opacity: 0; -webkit-transition: all .5s cubic-bezier(0, .5, .25, 1); -moz-transition: all .5s cubic-bezier(0, .5, .25, 1); transition: all .5s cubic-bezier(0, .5, .25, 1); } #link_1:target h1 { margin-left: 0; opacity: 1; -webkit-transition-delay: .4s; -moz-transition-delay: .4s; transition-delay: .4s; } #link_1 p { margin-left: -50px; opacity: 0; -webkit-transition: all .5s cubic-bezier(0, .5, .25, 1); -moz-transition: all .5s cubic-bezier(0, .5, .25, 1); transition: all .5s cubic-bezier(0, .5, .25, 1); } #link_1:target p { margin-left: 0; opacity: 1; -webkit-transition-delay: .5s; -moz-transition-delay: .5s; transition-delay: .5s; } #link_2 { position: absolute; top: 0; left: 5%; display: block; width: 90%; height: 0px; margin-top: 110px; background: -webkit-linear-gradient(rgb(40, 40, 40), rgb(60, 60, 60)); background: -moz-linear-gradient(rgb(40, 40, 40), rgb(60, 60, 60)); background: linear-gradient(rgb(40, 40, 40), rgb(60, 60, 60)); opacity: 0; z-index: -99999; text-align: center; -webkit-transform: skewY(-10deg); -moz-transform: skewY(-10deg); transform: skewY(-10deg); -webkit-transition: all .5s cubic-bezier(0, .5, .25, 1); -moz-transition: all .5s cubic-bezier(0, .5, .25, 1); transition: all .5s cubic-bezier(0, .5, .25, 1); } #link_2::before { content: ""; position: absolute; top: -21px; left: -10px; width: 100%; height: 4%; background-color: rgb(70, 70, 70); .........完整代码请登录后点击上方下载按钮下载查看
网友评论0