Horje
How to create HTML alt Attribute

The required alt attribute for the <img> tag specifies an alternate text for an image, if the image for some reason cannot be displayed. This can be due to a slow connection, or an error in the src attribute, or if the user uses a screen reader.


How is to look HTML alt Attribute

alt="Girl with a jacket"

Full Example of HTML alt Attribute

Here image url work
index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<h2>The alt Attribute</h2>
<p>The alt attribute should reflect the image content, so users who cannot see the image get an understanding of what the image contains:</p>

<img src="https://itupto.com/avatar.png" alt="Girl with a jacket" width="200" height="200">

</body>
</html>

Output should be:

Full Example of HTML alt Attribute

Here alt visible

Because Image link not work
index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<img src="img_typo.jpg" alt="Girl with a jacket">

<p>If we try to display an image that does not exist, the value of the alt attribute will be displayed instead. </p>

</body>
</html>

Output should be:

Here alt visible





Related Articles
What is HTML Attributes HTML Attributes
How to create HTML href Attribute HTML Attributes
How to create HTML src Attribute HTML Attributes
How to create HTML width and height Attributes HTML Attributes
How to create HTML alt Attribute HTML Attributes
How to create HTML style Attribute HTML Attributes
How to create lang Attribute HTML Attributes
How to create HTML title Attribute HTML Attributes
How to create HTML Single or Double Quotes HTML Attributes
What is HTML Headings HTML Attributes
How to create HTML Headings HTML Attributes
What is Headings Are Important HTML Attributes
How to create HTML Bigger Headings HTML Attributes

Single Articles
How is to look HTML alt AttributeHTML Attributes
Full Example of HTML alt AttributeHTML Attributes
Here alt visibleHTML Attributes

Read Full:
HTML Attributes
Category:
Web Tutorial
Sub Category:
HTML Attributes
Uploaded:
1 year ago
Uploaded by:
Admin
Views:
203


Reffered: https://www.w3schools.com/html/tryit.asp?filename=tryhtml_attributes_alt

Share on: