html tutorial - alt Attribute in HTML - html5 - html code - html form

html image

Learn html - html tutorial - Alt attribute in html - html examples - html programs

  • The alt attribute is used to declare the alternate name for the image.
  • When the image is not loaded properly then the alternate text will get display instead of image.
  • The image will not get displayed properly because of following reasons:
    • Network failure
    • Slow connection
    • Source attribute path errors

Syntax for alt attribute in HTML:

<img alt=”text”>

Applies To:

Elements Attribute
<area> alt
<img> alt
<input> alt

alt Attribute Value:

Value Description
text Define the alternate text.

Sample Coding for alt Attribute in HTML:

Tryit<!DOCTYPE html>
        <title>Wikitechy-alt attribute</title>
        <img src=”Wikitechylogo.png” alt="" 
         width="175" height="65">

Code Explanation for alt Attribute in HTML:

alt Attribute Code Explanation

  1. The <img> tag is used to show an image.
  2. src - used to specifies the location of the image.
  3. “Wikitechylogo.png” is the location of the image.
  4. alt attribute – used to define alternative text for the image as “”.

Output for alt Attribute in HTML:

alt Attribute Output

  1. The image will not get displayed so alternative text has been displayed instead of the image.

Browser Support for alt Attribute in HTML:

Yes Yes Yes Yes Yes

Related Searches to alt Attribute in html

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add to your ad blocking whitelist or disable your adblocking software.