HTML <img> alt Atribut

❮ HTML tag <img>

Příklad

Obrázek se zadaným alternativním textem:

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

Definice a použití

Povinný altatribut určuje alternativní text pro obrázek, pokud obrázek nelze zobrazit.

Atribut altposkytuje alternativní informace pro obrázek, pokud jej uživatel z nějakého důvodu nemůže zobrazit (z důvodu pomalého připojení, chyby v srcatributu nebo pokud uživatel používá čtečku obrazovky).

Tip: Chcete-li vytvořit nápovědu pro obrázek, použijte titleatribut!


Podpora prohlížeče

Attribute
alt Yes Yes Yes Yes Yes

Syntax

<img alt="text">

Hodnoty atributů

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

❮ HTML tag <img>