我们知道,使用CSS3做出来的下拉菜单是不兼容IE6的,而IE8和以下也就不支持一些CSS3的属性了,比如opacity、transition等。这次就来给大家说一下用css3实现动画下拉菜单效果的实现步骤。
site-navigation ul ul{min-width: 100px; position: absolute; left:0; top:100%; visibility: hidden; opacity: 0; -webkit-transition:all .3s ease-in-out; transition:all .3s ease-in-out; margin-top:20px; background-color: #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.2); background-color: #F0F0F0;} .site-navigation ul li:hover > ul{visibility: visible; opacity: 1; margin-top:0;} .site-navigation ul ul ul{ left:100%; top:0; margin-top: 0; margin-left: 20px;} .site-navigation ul ul li:hover > ul{margin-left:0;} .nav ul{height:0;overflow:hidden;left:0; top:100%;position:absolute;} .nav li:hover ul{height:auto;width:180px} .nav li ul li{opacity:0;-webkit-transition:0.5s;transition:0.5s;width:100%;-webkit-transition-delay:0s;transition-delay:0s} .nav li:hover ul li{opacity:1;-webkit-transition-delay:0.5s;transition-delay:0.5s} .nav ul li a{background:#7770B4;border-color:#6E67A6;color:#fff;line-height:1px;-webkit-transition:1.5s;transition:1.5s} .nav li:hover ul li a{line-height:35px} .nav ul{left:0; position:absolute;top:100%; min-width: 120px; visibility: hidden; opacity: 0;} .nav li ul li{opacity:0; -webkit-transition:0.5s;transition:0.5s;width:100%;-webkit-transition-delay:0s;transition-delay:0s} .nav li:hover > ul{opacity: 1; visibility: visible;} .nav li:hover > ul > li{opacity:1;-webkit-transition-delay:0.5s;transition-delay:0.5s} .nav ul li a{background:#7770B4;border-color:#6E67A6;color:#fff;line-height:1px;-webkit-transition:1.5s;transition:1.5s; white-space: nowrap;} .nav li:hover > ul > li a{line-height:35px} .nav ul ul{left:100%; top:0;}
相信看了这些案例你已经掌握了方法,更多精彩请关注php中文网其它相关文章!
相关阅读:
Atas ialah kandungan terperinci 用css3实现动画下拉菜单效果的实现步骤. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!