jjzjj

javascript - 此警告消息是什么意思? 'img elements must have an alt prop, either with meaningful text, or an empty string for decorative images'

coder 2024-05-11 原文

为什么我会收到此警告?

warning: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images jsx-a11y/img-has-alt

它显示第 13 行,但没有使用任何 Prop 。

最佳答案

这意味着当您在 HTML 中创建图像时,为了屏幕阅读器和文本浏览器的利益,您应该包含一个 alt 属性。

<img src="url" alt="description of image">

关于javascript - 此警告消息是什么意思? 'img elements must have an alt prop, either with meaningful text, or an empty string for decorative images',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43812733/

有关javascript - 此警告消息是什么意思? 'img elements must have an alt prop, either with meaningful text, or an empty string for decorative images'的更多相关文章

随机推荐