HTML img tag: title attribute vs. alt attribute?

后端 未结 11 779
悲&欢浪女
悲&欢浪女 2020-12-07 12:01

I was browsing Amazon and I noticed that when searching \"1TB\" if you hover the mouse cursor over the stars rating image, you only see the score if using IE. If you are u

11条回答
  •  时光说笑
    2020-12-07 12:28

    That's because they serve different purposes and they both should be used not just one over the other.

    The "alt" is for what you guys already said, so you can see what's the image it's all about if the image can't be displayed (for whatever reason), it also allows visually impaired people to understand what's the image about.

    The "title" attribute is the correct one to show the tooltip with a title for the image.

提交回复
热议问题