SVG <Image> 元素中等效的 Alt 标记
Alt tag equivalent in an SVG <Image> element
当我使用 <img>
HTML 标签时,我总是使用 alt
属性来实现可访问性。
将 alt="some text"
添加到 SVG <image>
元素中似乎不起作用?
在此示例中提供替代文本的最佳方式是什么?
我必须使用 SVG <image>
元素,所以我不能选择其他 DOM 元素答案。
<svg x="0px" y="0px" viewBox="0 0 910 1295" style="enable-background:new 0 0 910 1295;" xml:space="preserve">
<image width="910" height="1295" xlink:href="https://i.postimg.cc/43DKn46z/colours.jpg">
</image>
</svg>
在此先感谢您的帮助。
相当于 SVG 中的 alt 标签的是 <desc>
子元素。
<svg x="0px" y="0px" viewBox="0 0 910 1295" style="enable-background:new 0 0 910 1295;" xml:space="preserve">
<image width="910" height="1295" xlink:href="https://i.postimg.cc/43DKn46z/colours.jpg">
<desc>Some description of the image</desc>
</image>
</svg>
当我使用 <img>
HTML 标签时,我总是使用 alt
属性来实现可访问性。
将 alt="some text"
添加到 SVG <image>
元素中似乎不起作用?
在此示例中提供替代文本的最佳方式是什么?
我必须使用 SVG <image>
元素,所以我不能选择其他 DOM 元素答案。
<svg x="0px" y="0px" viewBox="0 0 910 1295" style="enable-background:new 0 0 910 1295;" xml:space="preserve">
<image width="910" height="1295" xlink:href="https://i.postimg.cc/43DKn46z/colours.jpg">
</image>
</svg>
在此先感谢您的帮助。
相当于 SVG 中的 alt 标签的是 <desc>
子元素。
<svg x="0px" y="0px" viewBox="0 0 910 1295" style="enable-background:new 0 0 910 1295;" xml:space="preserve">
<image width="910" height="1295" xlink:href="https://i.postimg.cc/43DKn46z/colours.jpg">
<desc>Some description of the image</desc>
</image>
</svg>