html - 为这些重叠的圆形导航项创建 anchor 链接?单个图像( Sprite )或切片或?

标签 html css sprite imagemap slice

为下图中的每个彩色圆圈设置单独链接的最佳方法是什么?

目标是让每个彩色圆圈链接到不同的页面,并且让它们不会相互干扰。如果我将它们切成薄片,每个图像当然都是一个正方形,因此会干扰其下方的图像(例如,橙色圆圈变成蓝色圆圈)。

我知道我可以使用图像映射(区域)。但我更喜欢非图像映射实现,因为 chrome 中当前图像映射的边框错误,以及谷歌对非图像映射 (SEO) 的偏好。

想法?

编辑:这张图片只是我完成设计时的实际表现,它是一堆带有设计的圆圈,所以图片是必需的。

Navigation

最佳答案

像这样的东西怎么样:http://jsfiddle.net/avTa8/

(不需要 sprites/images,但你需要支持 border-radius [参见 http://css3pie.com/ ])

demo 仅使用 border-radius,使用 -moz-border-radius 支持 FF 等。

html

<div id="a" onclick="window.location='http://www.google.com';"></div>
<div id="b" onclick="window.location='http://www.stackoverflow.com';"></div>
<div id="c" onclick="window.location='http://www.stackoverflow.com';"></div>
<div id="d" onclick="window.location='http://www.stackoverflow.com';"></div>
<div id="e" onclick="window.location='http://www.stackoverflow.com';"></div>
<div id="f" onclick="window.location='http://www.stackoverflow.com';"></div>

CSS

#a:hover,
#b:hover,
#c:hover,
#d:hover,
#e:hover,
#f:hover {
    cursor:pointer;
    background-color:#333;
}

#a {
    position:absolute;
    border-radius:100px;
    background-color:#72CEE0;
    width:100px;
    height:100px;
    left:150px;
}

#b {
    position:absolute;
    border-radius:90px;
    background-color:green;
    width:90px;
    height:90px;
    top:130px;
    left:50px;
}

#c {
    position:absolute;
    border-radius:100px;
    background-color:orange;
    width:100px;
    height:100px;
    top:60px;
    left:85px;
}

#d {
    position:absolute;
    border-radius:80px;
    background-color:red;
    width:80px;
    height:80px;
    top:130px;
    left:210px;
}

#e {
    position:absolute;
    border-radius:80px;
    background-color:purple;
    width:80px;
    height:80px;
    top:200px;
    left:270px;
}

#f {
    position:absolute;
    border-radius:100px;
    background-color:magenta;
    width:100px;
    height:100px;
    top:220px;
    left:150px;
}

关于html - 为这些重叠的圆形导航项创建 anchor 链接?单个图像( Sprite )或切片或?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6654283/

相关文章:

css - 表单提交按钮@Transparent CSS Sprites

javascript - jQuery 不取消选中复选框

html - 如何对齐和调整 Bootstrap 列的大小?

css - 如何在 Bootstrap 3.2 的导航栏中将品牌形象与其他元素居中?

安卓 WebView : dezoom to fit content

CSS 显示文本框

将 <br> 标签转换为空格的 jQuery .text() 等价物

javascript - 我可以在尝试预加载 XHR 数据时添加自定义标题吗?

java - LibGDX 1.5 围绕其中心旋转 Sprite

python - Pygame: Sprite 侧面的碰撞