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>
<html>
    <head>
        <title>Wikitechy-alt attribute</title>
    </head>
    <body>
        <img src=”Wikitechylogo.png” alt="Wikitechy.com" 
         width="175" height="65">
    </body>
</html>

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 “Wikitechy.com”.

Output for alt Attribute in HTML:

alt Attribute Output

  1. The image will not get displayed so alternative text Wikitechy.com 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 wikitechy.com to your ad blocking whitelist or disable your adblocking software.

×