img标签的alt属性是否需要编码? [英] Does the img tag's alt attribute require encoding?
本文介绍了img标签的alt属性是否需要编码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在html中 img标签的alt属性内的文本需要编码/转义?
In html does the text inside the img tag's alt attribute require encoding/escaping?
非编码示例:
<img src="myimg.png" alt="image description" />
编码示例:
<img src="myimg.png" alt="image%20description" />
推荐答案
不,它不需要像URI。但是,HTML字符必须被编码,像这样...
No, it does not need to be encoded like a URI. However, HTML characters must be encoded, like this...
<img src="myimg.png" alt="Me & my image" />
这篇关于img标签的alt属性是否需要编码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文