Skip to content

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

@webVueBlog

Description

@webVueBlog
Member

解答:

  1. alt 是图片加载失败时,显示在网页上的替代的文字;
  2. title 是鼠标放上面时显示的文字。
    这些都是表面上的区别,altimg必要的属性,而title不是。

Activity

changed the title [-]1.请问<img>种的title和alt有什么区别?[/-] [+]1.请问<img>中的title和alt有什么区别?[/+] on Mar 9, 2020
haizhilin2013

haizhilin2013 commented on Mar 9, 2020

@haizhilin2013

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

webVueBlog

webVueBlog commented on Mar 11, 2020

@webVueBlog
MemberAuthor

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @haizhilin2013@webVueBlog

        Issue actions

          1.请问<img>中的title和alt有什么区别? · Issue #1 · weekCodeing/interview-answe