CSS实现多彩的六边形蜂窝菜单
CSS实现多彩的六边形蜂窝菜单,爱她没商量。不管菜单是否实用,单凭用CSS实现六边形,就已经很值得我们推敲了。
答案:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>一个六角形的、类似马蜂窝的菜单</title>
<style type="text/css">
#outer {
background:width:730px; text-align:center; padding-top:20px; height:330px; border:1px solid #000; position:relative;}
* html #outer {height:350px; height:330px;}
#hex {padding:0; margin:0 auto; list-style:none; width:325px;}
#hex li {display:block; float:left; width:104px; margin-right:4px; height:120px;}
#hex li.p1 {padding-left:54px;}
#hex li.p2 {margin-top:-26px;}
#hex li a {text-decoration:none; color:#000; cursor:pointer;}
#hex li a b {display:block; width:0; height:0; overflow:hidden; border-bottom:30px solid #ec0; border-left:52px dotted
transparent; border-right:52px dotted transparent;}
#hex li a span {display:block; width:104px; height:60px; line-height:59px; text-align:center; background:#ec0;
font-size:11px; font-family: arial, veradana, sans-serif;}
#hex li a em {display:block; width:0; height:0; overflow:hidden; border-top:30px solid #ec0; border-left:52px dotted
transparent; border-right:52px dotted transparent;}
/* hack for IE5.5 */
* html #hex li a b, * html #hex li a em {width:104px; height:30px; w\idth:0; he\ight:0;}
#hex li a.inner b {border-bottom-color:#c60;}
#hex li a.inner span {background:#c60;}
#hex li a.inner em {border-top-color:#c60;}
#hex li a:hover {white-space:normal; color:#fff;}
#hex li a:hover b {border-bottom-color:#c90;}
#hex li a:hover span {background:#c90;}
#hex li a:hover em {border-top-color:#c90;}
#hex li a.inner:hover b {border-bottom-color:#a40;}
#hex li a.inner:hover span {background:#a40;}
#hex li a.inner:hover em {border-top-color:#a40;}
#flower {width:100px; height:100px; position:absolute; left:45px; top:110px; background:transparent;}
#flower b {display:block; width:0; height:0; overflow:hidden; border-top:23px dotted transparent; border-bottom:23px
dotted transparent; position:absolute; cursor:pointer;}
/* hack for IE5.5 */
* html #flower b {width:39px; height:46px; w\idth:0; he\ight:0;}
#flower a, #flower a:visited {text-decoration:none;}
#flower b.p1 {border-right:39px solid #ec0;}
#flower b.p2 {border-left:39px solid #c60;}
#flower b.a1 {top:1px; left:9px;}
#flower b.a2 {top:1px; right:9px;}
#flower b.a3 {top:27px; left:7px;}
#flower b.a4 {top:27px; left:54px;}
#flower b.a5 {top:53px; left:9px;}
#flower b.a6 {top:53px; right:9px;}
#flower a:hover {white-space:normal; cursor:pointer;}
#flower a:hover b.p1 {border-right:39px solid #c60;}
#flower a:hover b.p2 {border-left:39px solid #ec0;}
</style>
</head>
<body>
<div id="outer">
<!-- this bit just for the fun of it -->
<div id="flower" title="border art flower - click for home page">
<a href="/index.html">
<b class="p1 a1"></b>
<b class="p2 a2"></b>
<b class="p2 a3"></b>
<b class="p1 a4"></b>
<b class="p1 a5"></b>
<b class="p2 a6"></b>
</a>
</div>
<!-- the menu -->
<ul id="hex">
<li class="p1"><a href="/"><b></b><span>DEMOS</span><em></em></a></li>
<li><a href="/"><b></b><span>MENUS</span><em></em></a></li>
<li class="p2"><a href="/"><b></b><span>LAYOUTS</span><em></em></a></li>
<li class="p2"><a class="inner" href="/"><b></b><span>BOXES</span><em></em></a></li>
<li class="p2"><a href="/"><b></b><span>MOZILLA</span><em></em></a></li>
<li class="p1 p2"><a href="/"><b></b><span>zzzyk.com</span><em></em></a></li>
<li class="p2"><a href="/"><b></b><span>OPACITY</span><em></em></a></li>
</ul>
</div>
</body>
</html>
上一个:B2B网站上常用的TAB选项卡
下一个:基本的全兼容纯CSS下拉菜单