IMAGES IN HTML
V Vidyashankar
HTML Images Syntax
■ The HTML < img > tag is used to embed an image in a web page
■ Images are linked to web pages and not technically inserted into
web pages
■ The < img > tag creates a holding space for the referenced image
■ The < img > tag is empty, it contains attributes only, and does
not have a closing tag
■ The < img > tag has two required attributes:
src – Specifies the path to the image
alt – Specifies an alternate text for the image
The src attribute
■ < img src = “url “ alt = “ alternatetext “
■ The required src attribute specifies the path (URL) to
the image
■ When a web page loads, the browser, at that moment,
gets the image from a web server and inserts it into
the page
■ If the browser cannot find the image, the broken link
icon and the alt text are shown
The alt attribute
■ The required alt attribute provides an alternate text
for an image
■ If, for some reason, the user cannot view the image
because of slow connections, an error in the src
attribute or if the user uses a screen reader
■ The value of the alt attribute should describe the
image
{ Screen reader – a software program that reads the
HTML code
and allows the user to “listen” to the content. Screen
readers are
CODE EXAMPLE