Curriculum
Course: HTML Basic
Login

Curriculum

HTML Basic

HTML Introduction

0/1

HTML Editors

0/1

HTML Attributes

0/1

HTML Paragraphs

0/1

HTML Formatting

0/1

HTML Comments

0/1

HTML Favicon

0/1

HTML Page Title

0/1

HTML Iframes

0/1

HTML Java Script

0/1

HTML File Paths

0/1

HTML Symbols

0/1
Text lesson

Src Attribute

The essential ‘src‘ attribute determines the image’s path or URL.

Keep in mind, it is during the webpage loading process that the browser retrieves the image from a server to display it on the page. Hence, it’s crucial to maintain the image’s location consistent relative to the webpage to prevent the appearance of a broken link symbol to your visitors. If the browser fails to locate the image, it will display a broken link icon along with the ‘alt’ text, which serves as an alternative description.

Example

<img src=”your image source/image.jpg” alt=”image name”>

When an image cannot be located by a browser, it will show the text specified in the ‘alt’ attribute instead.

 

Click to Learn

The alt Attribute

The required alt attribute provides alternate text for an image if the user cannot view it for some reason, such as a slow connection, an error in the src attribute, or the use of a screen reader.

The alt attribute’s value should describe the image:

Example

<img src=”img_chania.jpg” alt=”Flowers in Chania”>

If a browser cannot locate an image, it will display the alt attribute’s value:

Example

<img src=”wrongname.gif” alt=”Flowers in Chania”>
Tip: A screen reader is a software program that interprets the HTML code, enabling users to “listen” to the content. Screen readers are particularly helpful for individuals who are visually impaired or have learning disabilities.