Atributo HTML <img> alt

❮ Tag HTML <img>

Exemplo

Uma imagem com um texto alternativo especificado:

<img src="img_girl.jpg" alt="Girl in a jacket" width="500" height="600">

Definição e uso

O altatributo obrigatório especifica um texto alternativo para uma imagem, se a imagem não puder ser exibida.

O altatributo fornece informações alternativas para uma imagem se um usuário por algum motivo não puder visualizá-la (devido a uma conexão lenta, um erro no srcatributo ou se o usuário usar um leitor de tela).

Dica: Para criar uma dica de ferramenta para uma imagem, use o titleatributo!


Suporte ao navegador

Attribute
alt Yes Yes Yes Yes Yes

Sintaxe

<img alt="text">

Valores de atributo

Value Description
text Specifies an alternate text for an image.

Guidelines for the alt text:

  • The text should describe the image if the image contains information
  • The text should explain where the link goes if the image is inside an <a> element
  • Use alt="" if the image is only for decoration

❮ Tag HTML <img>