HTML5 svg标签和alt属性 [英] HTML5 svg tag and alt attribute

查看:158
本文介绍了HTML5 svg标签和alt属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不是HTML专家并检查HTML解析器的正确行为(根据html5寻找正确的行为不好或没有期望(我们可以稍后处理)).

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)).

在新的HTML5< svg>中,标签放置"alt"属性是否有效?

In the new HTML5 <svg> tag is it valid to place the "alt" attribute?

<svg width="120" height="35" alt="Stuff">
  {{ STUFF }}
</svg>

或者应该将< svg>嵌入在< img>实现这一目标?

Or should the <svg> be imbedded inside an <img> to achieve this?

<img alt="Stuff">
   <svg width="120" height="35">
      {{ STUFF }}
   </svg>
</img>

推荐答案

SVG没有alt属性,而是使用< desc> 子标记.

SVG doesn't have an alt attribute, it uses a <desc> child tag instead.

<svg width="120" height="35">
  <desc>Stuff</desc>
  {{ STUFF }}
</svg>

这篇关于HTML5 svg标签和alt属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆