扇形导航菜单
1.装bi界的一股清流,基本没什么用,反而把页面搞复杂了。
2.这些用法值得学习和借鉴。
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="UTF-8"> 5 <title>CSS3扇形动画菜单</title> 6 <style> 7 *{padding: 0; margin: 0;} 8 body{background:#b1b1b1;margin:0px;padding:0px;font-size:14px;color:#000;} 9 .menuHolder {width:100px; height:100px; margin:0 0 250px 0; position:relative;z-index:100;} 10 .menuHolder ul {padding:0px; margin:0; list-style:none; position:absolute; left:0; top:0; width:0; height:0;} 11 /*.menuHolder ul li {border-radius:0 0 300px 0; width:0; height:0;}*/ 12 .menuHolder ul li a {color:#000; text-decoration:none; font:bold 13px/30px arial, sans-serif; text-align:center; 13 box-shadow:-5px 5px 5px rgba(0,0,0,0.4);transform-origin:0 0;} 14 .menuHolder ul.p1 li {position:absolute; left:0; top:0;} 15 .menuHolder ul.p2 {z-index:-1;} 16 .menuHolder ul.p3 {z-index:-1;} 17 /*画第一个圆圈*/ 18 .menuHolder li.s1 > a {position:absolute; display:block; width:100px; height:100px; background:#c8c8c8; border-radius:0 0 100px 0;} 19 /*画第二个圆圈*/ 20 .menuHolder li.s2 > a {position:absolute; display:block; width:100px; padding-left:100px; height:200px; background:#ddd; border-radius:0 0 200px 0;} 21 /*画第三个圆圈*/ 22 .menuHolder ul.p3 li a {position:absolute; display:block; width:100px; padding-left:200px; height:300px; background:#999; border-radius:0 0 300px 0;} 23 /*把第二第三个圆隐藏到角落里去,让视角看不到*/ 24 .menuHolder ul ul {transform-origin:0 0;transform:rotate(90deg);transition:1s;} 25 /*绘制第二层的菜单*/ 26 .menuHolder li.s2:nth-of-type(6) > a {background:#888; 27 transform:rotate(75deg); 28 } 29 .menuHolder li.s2:nth-of-type(5) > a {background:#999; 30 transform:rotate(60deg); 31 } 32 .menuHolder li.s2:nth-of-type(4) > a {background:#aaa; 33 transform:rotate(45deg); 34 } 35 .menuHolder li.s2:nth-of-type(3) > a {background:#bbb; 36 transform:rotate(30deg); 37 } 38 .menuHolder li.s2:nth-of-type(2) > a {background:#ccc; 39 transform:rotate(15deg); 40 } 41 /*绘制联系的子菜单*/ 42 .menuHolder .a6 li:nth-of-type(6) > a {background:#444; 43 transform:rotate(75deg); 44 } 45 .menuHolder .a6 li:nth-of-type(5) > a {background:#555; 46 transform:rotate(60deg); 47 } 48 .menuHolder .a6 li:nth-of-type(4) > a {background:#666; 49 transform:rotate(45deg); 50 } 51 .menuHolder .a6 li:nth-of-type(3) > a {background:#777; 52 transform:rotate(30deg); 53 } 54 .menuHolder .a6 li:nth-of-type(2) > a {background:#888; 55 transform:rotate(15deg); 56 } 57 /*绘制销量的子菜单*/ 58 .menuHolder .a5 li:nth-of-type(5) > a {background:#555; 59 transform:rotate(72deg); 60 } 61 .menuHolder .a5 li:nth-of-type(4) > a {background:#666; 62 transform:rotate(54deg); 63 } 64 .menuHolder .a5 li:nth-of-type(3) > a {background:#777; 65 transform:rotate(36deg); 66 } 67 .menuHolder .a5 li:nth-of-type(2) > a {background:#888; 68 transform:rotate(18deg); 69 } 70 /*绘制服务、商店、联系我们的子菜单*/ 71 .menuHolder .a3 li:nth-of-type(3) > a {background:#777; 72 transform:rotate(60deg); 73 } 74 .menuHolder .a3 li:nth-of-type(2) > a {background:#888; 75 transform:rotate(30deg); 76 } 77 /*鼠标滑过第一层菜单展开第二层菜单*/ 78 .menuHolder li.s1:hover ul.p2 { 79 transform:rotate(0deg); 80 } 81 /*鼠标滑过第二层菜单展开第三层菜单*/ 82 .menuHolder li.s2:hover ul.p3 { 83 transform:rotate(0deg); 84 } 85 /*鼠标滑过改变背景颜色和文字颜色*/ 86 .menuHolder ul li:hover > a {background:#f00; color:#fff;} 87 .menuHolder li.s2:hover > a {background:#d00; color:#fff;} 88 .menuHolder .a6 li:hover > a {background:#b00; color:#fff;} 89 .menuHolder .a5 li:hover > a {background:#b00; color:#fff;} 90 .menuHolder .a3 li:hover > a {background:#b00; color:#fff;} 91 </style> 92 </head> 93 <body> 94 <div class="menuHolder"> 95 <div class="menuWindow"> 96 <ul class="p1"> 97 <li class="s1"><a href="#url">导航菜单</a> 98 <ul class="p2"> 99 <li class="s2"><a href="#"><span>首页</span></a></li> 100 <li class="s2"><a href="#url"><span>服务</span></a> 101 <ul class="p3 a3"> 102 <li><a href="#">打印</a></li> 103 <li><a href="#">编辑</a></li> 104 <li><a href="#">保管</a></li> 105 </ul> 106 </li> 107 <li class="s2"><a href="#url"><span>联系</span></a> 108 <ul class="p3 a6"> 109 <li><a href="#">支持</a></li> 110 <li><a href="#">销售</a></li> 111 <li><a href="#">购买</a></li> 112 <li><a href="#">摄影师</a></li> 113 <li><a href="#">零售商</a></li> 114 <li><a href="#">常规</a></li> 115 </ul> 116 </li> 117 <li class="s2"><a href="#url"><span>商店</span></a> 118 <ul class="p3 a3"> 119 <li><a href="#">南区</a></li> 120 <li><a href="#">北区</a></li> 121 <li><a href="#">中心区</a></li> 122 </ul> 123 </li> 124 <li class="s2"><a href="#url"><span>联系我们</span></a> 125 <ul class="p3 a3"> 126 <li><a href="#">邮箱</a></li> 127 <li><a href="#">邮递</a></li> 128 <li><a href="#">电话</a></li> 129 </ul> 130 </li> 131 <li class="s2 b6"><a href="#url"><span>销量</span></a> 132 <ul class="p3 a5"> 133 <li><a href="#">数码单反机身</a></li> 134 <li><a href="#">镜头</a></li> 135 <li><a href="#">闪光枪</a></li> 136 <li><a href="#">三角架</a></li> 137 <li><a href="#">过滤器</a></li> 138 </ul> 139 </li> 140 </ul> 141 </li> 142 </ul> 143 </div> 144 </div> 145 </body> 146 </html>