为了让我的内联 SVG 图像更容易被 google 搜索到,您可以在 svg 元素(例如“路径”、“圆”、“线”等)中添加 alt/title 属性/特性吗?
我已经知道您可以在“svg”标签内使用标题标签,就像这样......
<svg>
<title>this is a title tag.</title>
</svg>
下面是我正在谈论的例子。
<svg version="1.1" id="Layer_1">
<style type="text/css">
.st0{fill:none;stroke:#000000;stroke-width:5;stroke-linecap:round;stroke-miterlimit:10;}
</style>
<path class="st0" title=“this is what I am talking about” d="M567,1136.2l37,10.9c13.3,3.9,27.2,3.1,39.9-2.4l0.6-0.3"/>
<line id="hi2" class="st5" alt=“This is what I am Talking About” x1="72" y1="-169.7" x2="108" y2="-169.7"/>
</svg>
最佳答案
据我所知,替代文本不能用于 SVG。您使用 <title>
是对的标签,但您也可以添加 <desc>
添加更多信息。
在这里查看这个答案:https://stackoverflow.com/a/4756461/3909886更详细地研究这个问题。
关于html - 我可以在 SVG 元素中使用 alt 和 title 属性吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33317207/