Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[html] 第304天 html的img标签为什么要添加alt属性呢? #1907

Open
haizhilin2013 opened this issue Feb 13, 2020 · 1 comment
Open
Labels
html html

Comments

@haizhilin2013
Copy link
Collaborator

第304天 html的img标签为什么要添加alt属性呢?

#50

我也要出题

@haizhilin2013 haizhilin2013 added the html html label Feb 13, 2020
@luckyMuChen
Copy link

alt 属性是一个必需的属性,它规定在图像无法显示时的替代文本。

假设由于一些原因,用户无法查看图像,alt属性可以为图像提供替代的信息。比如:

  • 网速太慢
  • src 属性中的错误
  • 浏览器禁用图像
  • 用户使用的是屏幕阅读器等

添加alt属性提示文本的好处有哪些:

  1. 有利于SEO优化,让搜索引擎爬虫蜘蛛爬取关键词
  2. 在很多情况下用户无法查看图像,可以让用户明白图片的意思,提高用户体验
  3. 便于百度的图片收录和优化,百度会对网站的title以及alt分析,进而分类进行排序

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
html html
Projects
None yet
Development

No branches or pull requests

2 participants