纯CSS3打造动感漂亮时尚的扇形菜单
程序员文章站
2022-05-30 22:59:24
扇形菜单想必大家对它并不陌生吧,本文为大家介绍下如何使用纯CSS3打造动感漂亮的扇形菜单,感兴趣的朋友可以学习下... 14-03-18...
复制代码
代码如下:<!doctype html>
<html lang=zh-cn>
<head>
<title>纯css3打造动感漂亮的扇形菜单</title>
<style>
*{margin:0px;padding:0px;}
body{background:#b1b1b1;margin:0px;padding:0px;font-size:14px;color:#000;}
.tips{width:702px;margin:0 auto;line-height:24px;padding-top:10px;}
.bredcolor{color:#fff;}
.menuholder {width:100px; height:100px; margin:0px 0 250px 0px; position:relative;z-index:100;}
.menuholder ul {padding:0; margin:0; list-style:none; position:absolute; left:0; top:0; width:0; height:0;}
.menuholder ul li {border-radius:0 0 300px 0; width:0; height:0;}
.menuholder ul li a {color:#000; text-decoration:none; font:bold 13px/30px arial, sans-serif; text-align:center; box-shadow:-5px 5px 5px rgba(0,0,0,0.4);
-webkit-transform-origin:0 0;
-moz-transform-origin:0 0;
-ms-transform-origin:0 0;
-o-transform-origin:0 0;
transform-origin:0 0;
}
.menuholder ul.p1 li {position:absolute; left:0; top:0;}
.menuholder ul.p2 {z-index:-1;}
.menuholder ul.p3 {z-index:-1;}
.menuholder li.s1 > a {position:absolute; display:block; width:100px; height:100px; background:#c8c8c8; border-radius:0 0 100px 0;}
.menuholder li.s2 > a {position:absolute; display:block; width:100px; padding-left:100px; height:200px; background:#ddd; border-radius:0 0 200px 0;}
.menuholder ul.p3 li a {position:absolute; display:block; width:100px; padding-left:200px; height:300px; background:#999; border-radius:0 0 300px 0;}
.menuholder ul ul {
-webkit-transform-origin:0 0;
-moz-transform-origin:0 0;
-ms-transform-origin:0 0;
-o-transform-origin:0 0;
transform-origin:0 0;
-webkit-transform:rotate(90deg);
-moz-transform:rotatez(90deg);
-ms-transform:rotate(90deg);
-o-transform:rotate(90deg);
transform:rotate(90deg);
-webkit-transition:1s;
-moz-transition:1s;
-ms-transition:1s;
-o-transition:1s;
transition:1s;
}
.menuholder li.s2:nth-of-type(6) > a {background:#888;
-webkit-transform:rotate(75deg);
-moz-transform:rotatez(75deg);
-ms-transform:rotate(75deg);
-o-transform:rotate(75deg);
transform:rotate(75deg);
}
.menuholder li.s2:nth-of-type(5) > a {background:#999;
-webkit-transform:rotate(60deg);
-moz-transform:rotatez(60deg);
-ms-transform:rotate(60deg);
-o-transform:rotate(60deg);
transform:rotate(60deg);
}
.menuholder li.s2:nth-of-type(4) > a {background:#aaa;
-webkit-transform:rotate(45deg);
-moz-transform:rotatez(45deg);
-ms-transform:rotate(45deg);
-o-transform:rotate(45deg);
transform:rotate(45deg);
}
.menuholder li.s2:nth-of-type(3) > a {background:#bbb;
-webkit-transform:rotate(30deg);
-moz-transform:rotatez(30deg);
-ms-transform:rotate(30deg);
-o-transform:rotate(30deg);
transform:rotate(30deg);
}
.menuholder li.s2:nth-of-type(2) > a {background:#ccc;
-webkit-transform:rotate(15deg);
-moz-transform:rotatez(15deg);
-ms-transform:rotate(15deg);
-o-transform:rotate(15deg);
transform:rotate(15deg);
}
.menuholder .a6 li:nth-of-type(6) > a {background:#444;
-webkit-transform:rotate(75deg);
-moz-transform:rotatez(75deg);
-ms-transform:rotate(75deg);
-o-transform:rotate(75deg);
transform:rotate(75deg);
}
.menuholder .a6 li:nth-of-type(5) > a {background:#555;
-webkit-transform:rotate(60deg);
-moz-transform:rotatez(60deg);
-ms-transform:rotate(60deg);
-o-transform:rotate(60deg);
transform:rotate(60deg);
}
.menuholder .a6 li:nth-of-type(4) > a {background:#666;
-webkit-transform:rotate(45deg);
-moz-transform:rotatez(45deg);
-ms-transform:rotate(45deg);
-o-transform:rotate(45deg);
transform:rotate(45deg);
}
.menuholder .a6 li:nth-of-type(3) > a {background:#777;
-webkit-transform:rotate(30deg);
-moz-transform:rotatez(30deg);
-ms-transform:rotate(30deg);
-o-transform:rotate(30deg);
transform:rotate(30deg);
}
.menuholder .a6 li:nth-of-type(2) > a {background:#888;
-webkit-transform:rotate(15deg);
-moz-transform:rotatez(15deg);
-ms-transform:rotate(15deg);
-o-transform:rotate(15deg);
transform:rotate(15deg);
}
.menuholder .a5 li:nth-of-type(5) > a {background:#555;
-webkit-transform:rotate(72deg);
-moz-transform:rotatez(72deg);
-ms-transform:rotate(72deg);
-o-transform:rotate(72deg);
transform:rotate(72deg);
}
.menuholder .a5 li:nth-of-type(4) > a {background:#666;
-webkit-transform:rotate(54deg);
-moz-transform:rotatez(54deg);
-ms-transform:rotate(54deg);
-o-transform:rotate(54deg);
transform:rotate(54deg);
}
.menuholder .a5 li:nth-of-type(3) > a {background:#777;
-webkit-transform:rotate(36deg);
-moz-transform:rotatez(36deg);
-ms-transform:rotate(36deg);
-o-transform:rotate(36deg);
transform:rotate(36deg);
}
.menuholder .a5 li:nth-of-type(2) > a {background:#888;
-webkit-transform:rotate(18deg);
-moz-transform:rotatez(18deg);
-ms-transform:rotate(18deg);
-o-transform:rotate(18deg);
transform:rotate(18deg);
}
.menuholder .a3 li:nth-of-type(3) > a {background:#777;
-webkit-transform:rotate(60deg);
-moz-transform:rotatez(60deg);
-ms-transform:rotate(60deg);
-o-transform:rotate(60deg);
transform:rotate(60deg);
}
.menuholder .a3 li:nth-of-type(2) > a {background:#888;
-webkit-transform:rotate(30deg);
-moz-transform:rotatez(30deg);
-ms-transform:rotate(30deg);
-o-transform:rotate(30deg);
transform:rotate(30deg);
}
.menuholder li.s1:hover ul.p2 {
-webkit-transform:rotate(0deg);
-moz-transform:rotatez(0deg);
-ms-transform:rotate(0deg);
-o-transform:rotate(0deg);
transform:rotate(0deg);
}
.menuholder li.s2:hover ul.p3 {
-webkit-transform:rotate(0deg);
-moz-transform:rotatez(0deg);
-ms-transform:rotate(0deg);
-o-transform:rotate(0deg);
transform:rotate(0deg);
}
.menuholder ul li:hover > a {background:#f00; color:#fff;}
.menuholder li.s2:hover > a {background:#d00; color:#fff;}
.menuholder .a6 li:hover > a {background:#b00; color:#fff;}
.menuholder .a5 li:hover > a {background:#b00; color:#fff;}
.menuholder .a3 li:hover > a {background:#b00; color:#fff;}
.menuwindow {width:110px; height:110px; overflow:hidden; position:absolute; left:0; top:0; z-index:100;
-webkit-transition:0s 1s;
-moz-transition:0s 1s;
-ms-transition:0s 1s;
-o-transition:0s 1s;
transition:0s 1s;
}
.menuholder:hover .menuwindow {width:310px; height:310px;
-webkit-transition:0s 0s;
-moz-transition:0s 0s;
-ms-transition:0s 0s;
-o-transition:0s 0s;
transition:0s 0s;
}
.menuholder span {display:block;
-webkit-transform:rotate(5deg);
-moz-transform:rotatez(5deg);
-ms-transform:rotate(5deg);
-o-transform:rotate(5deg);
transform:rotate(5deg);
}
.menuholder ~ img.close {width:0; height:0; position:fixed; z-index:-1; left:0; top:0;}
.menuholder:hover ~ img.close {width:100%; height:100%;}
</style>
</head>
<body>
<div class="menuholder">
<div class="menuwindow">
<ul class="p1">
<li class="s1"><a href="#url">menu</a>
<ul class="p2">
<li class="s2"><a href="http://www.webdm.cn/"><span>home</span></a></li>
<li class="s2"><a href="#url"><span>services</span></a>
<ul class="p3 a3">
<li><a href="#">printing</a></li>
<li><a href="#">editing</a></li>
<li><a href="#">storage</a></li>
</ul>
</li>
<li class="s2"><a href="#url"><span>contacts</span></a>
<ul class="p3 a6">
<li><a href="#">support</a></li>
<li><a href="#">sales</a></li>
<li><a href="#">buying</a></li>
<li><a href="#">photographers</a></li>
<li><a href="#">stockist</a></li>
<li><a href="#">general</a></li>
</ul>
</li>
<li class="s2"><a href="#url"><span>stores</span></a>
<ul class="p3 a3">
<li><a href="#">south region</a></li>
<li><a href="#">north region</a></li>
<li><a href="#">central region</a></li>
</ul>
</li>
<li class="s2"><a href="#url"><span>contact us</span></a>
<ul class="p3 a3">
<li><a href="#">email</a></li>
<li><a href="#">post</a></li>
<li><a href="#">telephone</a></li>
</ul>
</li>
<li class="s2 b6"><a href="#url"><span>sales</span></a>
<ul class="p3 a5">
<li><a href="#">dslr cameras</a></li>
<li><a href="#">lenses</a></li>
<li><a href="#">flash guns</a></li>
<li><a href="#">tripods</a></li>
<li><a href="#">filters</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
</body>
</html>