HTML <input> alt属性

❮HTML<input>タグ

送信ボタンを表す画像を含むHTMLフォーム:

<form action="/action_page.php">
  <label for="fname">First name:</label>
  <input type="text" id="fname" name="fname">
  <input type="image" src="submit.gif" alt="Submit" width="48" height="48">
</form>

定義と使用法

altユーザーが何らかの理由で画像を表示できない場合(接続が遅い、src属性のエラー、またはユーザーがスクリーンリーダーを使用している場合)、この属性はユーザーに代替テキストを提供します。

注:このalt属性は、でのみ使用できます <input type="image">


ブラウザのサポート

Attribute
alt Yes Yes Yes Yes Yes

構文

<input alt="text">

属性値

Value Description
text Specifies an alternate text for the image

❮HTML<input>タグ