【发布时间】:2018-05-15 22:33:34
【问题描述】:
我要直奔“问题”。我有一张代表葡萄牙的 SVG 地图。所以我想要的是:当我将鼠标悬停在一个地区(例如里斯本)上时,它会改变颜色。现在所有的区域都是灰色的,我希望它们只有在我将鼠标悬停在它们上方时才显示为橙色。
我考虑过连接/调用一个 css 文件来为每个区域运行 a:hover{color: orange;} 代码。但是,它没有用。
为什么我不能在 <path> 中使用 <style>?
现在我的“Portugal.svg”上有这段代码:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet idhref="mystyle.css" type="text/css"?>
<html>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
baseprofile="tiny"
height="435.27365"
version="1.2"
viewbox="0 0 1000 597"
width="431.70035"
id="svg25"
sodipodi:docname="Portugal.svg"
style="fill:#7c7c7c;stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-linejoin:round"
inkscape:version="0.92.1 r15371"
xmlns:style="http://www.w3.org/TR/SVG/mystyle.css">
<a xlink:href="http://www.artiroots.pt/devel-230b433e/wordpress/?s=Setubal">
<title>Setúbal</title>
<g>
<path
d="259......."
id="P....."
name="Setúbal"
fill="#7c7c7c"
inkscape:connector-curvature="0"
style="stroke-width: 0.100"
/>
</g>
</a>
</svg>
</html>
感谢您的帮助,我真的很感激!
【问题讨论】:
-
“我对此有很多问题,我已经搜索了很多,但不知道该怎么做。” - 这不是在这里工作的好基础.首先,请阅读How to Ask。然后告诉我们您的研究结果(不,这不能是“无”),以及您尝试了哪些结果。