问题
Not an expert in HTML and checking the correct behavior of an HTML parser (looking for correct behavior according to html5 not good or expect (we can handle that later)).
In the new HTML5 <svg> tag is it valid to place the "alt" attribute?
<svg width="120" height="35" alt="Stuff">
{{ STUFF }}
</svg>
Or should the <svg> be imbedded inside an <img> to achieve this?
<img alt="Stuff">
<svg width="120" height="35">
{{ STUFF }}
</svg>
</img>
回答1:
SVG doesn't have an alt attribute, it uses a <desc>
child tag instead.
<svg width="120" height="35">
<desc>Stuff</desc>
{{ STUFF }}
</svg>
来源:https://stackoverflow.com/questions/22823770/html5-svg-tag-and-alt-attribute