[英]SVG anchor current page highlight
I have an SVG-based menu with links similar to the following. 我有一个基于SVG的菜单,带有类似于以下内容的链接。 I'd like to highlight the current page's link (eg, by adding "font-weight:bold").
我想突出显示当前页面的链接(例如,添加“ font-weight:bold”)。 Any suggestions?
有什么建议么? Should I do something with Javascript?
我应该用Java做些什么吗? (Note that I'm linking the SVG in my HTML page via an <object> tag for compatibility, so the solution has to work with that constraint.) Oh, and I'm fine with the highlight only working in modern browsers.
(请注意,为了兼容性,我正在通过<object>标记在HTML页面中链接SVG,因此该解决方案必须使用该约束。)哦,我只对现代浏览器有效。
<svg ...>
<style type="text/css">
a text {
fill:#ffffff;
}
a:hover text {
fill:#2020ff;
}
</style>
<g>
<a id="aHome" xlink:href="/" target="_top">
<text id="txtHome">Home</text>
</a>
...
</g>
</svg>
Well, apparently forgetting about this for a week was worth a bronze badge. 好吧,显然忘了一个星期值得一枚铜牌。 :-P
:-P
Anyways, the code above is actually correct by itself. 无论如何,上面的代码本身实际上是正确的。 Go figure - I had other overriding CSS styles that caused the a:hover bit to fail.
试一试-我还有其他的主要CSS样式导致a:hover位失败。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.