問題描述
我正在為我的所有圖像添加 alt
屬性以提高 SEO/屏幕閱讀器性能.
I'm adding alt
attributes to all my images to improve SEO/screen reader performance.
根據(jù)最佳實(shí)踐,純美學(xué)圖像應(yīng)該有一個(gè)空的 alt 屬性 alt=""
,以便屏幕閱讀器跳過它們.我在 WordPress 中發(fā)現(xiàn)它確實(shí)將 alt
添加到這些無描述的美學(xué)圖像中,但沒有添加 alt=""
.
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=""
.
屏幕閱讀器和搜索引擎爬蟲讀取 alt
是否與 alt=""
相同,或者我應(yīng)該進(jìn)入并以編程方式強(qiáng)制 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=""
?
推薦答案
是的,都一樣:https://www.w3.org/TR/html5/syntax.html#attributes-0
空屬性語法
只是屬性名稱.該值隱含為空字符串.
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.
這個(gè)的回答也是這么說的.
這篇關(guān)于alt 和 alt="" 一樣嗎?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!