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

1.请问<img>中的title和alt有什么区别? #1

Open
webVueBlog opened this issue Mar 9, 2020 · 2 comments
Open

1.请问<img>中的title和alt有什么区别? #1

webVueBlog opened this issue Mar 9, 2020 · 2 comments
Labels
html html

Comments

@webVueBlog
Copy link
Member

webVueBlog commented Mar 9, 2020

解答:

  1. alt 是图片加载失败时,显示在网页上的替代的文字;
  2. title 是鼠标放上面时显示的文字。
    这些都是表面上的区别,altimg必要的属性,而title不是。
@webVueBlog webVueBlog added the html html label Mar 9, 2020
@webVueBlog webVueBlog changed the title 1.请问<img>种的title和alt有什么区别? 1.请问<img>中的title和alt有什么区别? Mar 9, 2020
@haizhilin2013
Copy link

还可以从seo的角度上做区别

@webVueBlog
Copy link
Member Author

Answer:

Alt is the alternate text that appears on the page when the image fails to load.
Title is the text displayed when the mouse is over it.
These are all superficial differences, Alt is a necessary attribute of img, and title is not.

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