<body>
<img src="cake.png" alt="Cake Photo">
</body>
在上面的代码中写alt属性的目的是什么,如果是为了可读性那么我们可以在src部分显示明确的意图。
最佳答案
"The
alt
attribute specifies an alternate text for an image, if the image cannot be displayed.The
alt
attribute provides alternative information for an image if a user for some reason cannot view it (because of slow connection, an error in the src attribute, or if the user uses a screen reader).Tip: To create a tooltip for an image, use the
title
attribute!"
关于html - 为什么我们要在 html 中向内容图像添加 alt 属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31766485/