【发布时间】:2013-04-15 09:51:18
【问题描述】:
我被指示让网站上的链接具有与字体颜色不同的颜色下划线。这一切看起来都很简单,使用border-bottom 如下,除了链接的图像现在也加了下划线。
有没有办法在不使用 JS 的情况下停止发生?
a{
color: #6A737B;
text-decoration: none;
}
a:hover{
border-bottom: 1px solid #C60B46;
text-decoration: none;
}
一个例子 - 现在将鼠标悬停在下面的图片上会添加 border-bottom CSS 样式,这是我不想要的 -
<a title="Dyne Drewett" href="http://test.dynedrewett.com">
<img class="attachment-full" width="202" height="78" alt="Dyne Drewett Solicitors" src="http://test.example.com/Website-Header.png">
</a>
【问题讨论】:
-
给图像一个onclick事件处理程序并跳过锚标记怎么样?我们仅对文本节点使用锚标记。
-
这将依赖于通过浏览器启用 JS 的用户。虽然这对大多数人来说都很好,但有些人将无法按预期浏览该网站。谢谢。