Is alt the same as alt=“”?

偶尔善良 提交于 2019-12-04 03:51:26

问题


I'm adding alt attributes to all my images to improve SEO/screen reader performance.

Per best practice, images that are purely aesthetic should have an empty alt attribute alt=""so screen readers skip over them. I'm in WordPress and noticed it does add alt to these descriptionless aesthetic images, but not alt="".

Does alt get read the same as alt="" by screen readers and search engine crawlers, or should I go in and programatically force an alt=""?


回答1:


Yes, it's the same: https://www.w3.org/TR/html5/syntax.html#attributes-0

Empty attribute syntax

Just the attribute name. The value is implicitly the empty string.

To me, that says that an attribute with no value is the same as having a value of empty string.

This answer says the same.



来源:https://stackoverflow.com/questions/44764441/is-alt-the-same-as-alt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!