site topic网站专题
首页
>
网站专题
>
专题详情
分享新闻到:

纯CSS鱼眼菜单

互诺科技:2009-11-01 00:00     阅读数:       标签:

fisheye

纯css鱼眼菜单的灵感来自于 Mac OSX Dock , 效果是让带小图标的菜单在鼠标滑过、停留时有放大的效果,鼠标停放的菜单两边的小图片也有一定比例的变化,具体效果可以猛点此处看DEMO

fisheye_down

实现图标向下放大效果:

1.HTML代码:

以下为引用的内容:

<div class="expand-down"><ul><li>      <a href=http://www.chinaz.com/Design/Pages/"http://jsssc.cn">        <!-- 图片-->        <img src="/images/demos/w3c-valid-css-trans.png" alt="" />        <!-- 文字-->        <span>路可</span>      </a>    <!--这里放你需要的其他菜单li --></li></ul></div>

2.CSS代码:

以下为引用的内容:

<!--.expand-down {  font-family:Arial, Helvetica, sans-serif;  line-height:normal;  margin-top:20px;  height:150px;  width:500px;  background: url(/images/demos/macosx-style-background.png) no-repeat;  margin-bottom:30px;}/* reset margins and paddings */.expand-down * {  margin: 0;  padding: 0;}.expand-down ul {  padding-top:10px;  margin-left:10px;}.expand-down ul li {  float:left;  list-style-type:none;}.expand-down ul li a {  text-decoration:none;}.expand-down ul li a img {  width:50px;  /* initial width of images, 50% of width */  height:50px; /* initial height of images, 50% of height */  border:none;}/* 先隐藏<span> */.expand-down ul li a span {  display:none;}.expand-down ul li:hover a span {  /* 显示*/  display:block;  font-size:14px;  text-align:center;  color:#fff;}/* 鼠标经过时放大图片.** an image becomes active when mouse hovers it** ideally, the image should have same width and height as below*/.expand-down ul li:hover a img {  width:100px;  height:100px;}/*设置相邻的li宽高 注意‘+’选择器*/.expand-down ul li:hover + li a img {  width:60px;  height:60px;}/*第二相邻li的宽高 这里用两个‘+’*/.expand-down ul li:hover + li + li a img {  width:55px;  height:55px;}-->

下载 源文件

分析:鱼眼效果主用是利用css的相邻兄弟节点选择器“+”和”:hover”伪类实现。

纯CSS的语言效果支持的浏览器有:Internet Explorer 7+ & 8+, Firefox 3+, Google Chrome, Safari 3.2+, Opera 9.52+, Konqueror 3.5.7+. 但是, “+”选择器仅仅支持 IE7+, IE8+, Opera 9.52+, and Konqueror 3.5.7+。

本文链接:http://jsssc.cn/10-promising-css-framework-that-worth-a-look/

出处:路可