<img>
tag, which is empty because it contains attributes only and has no closing tag.
To display an image on a page, you need to use the src
attribute.
src
stands for “source.”
The value of the src
attribute is the URL of the image you want to display on your page.
The syntax and an example are given below.
The URL points to the location where the image is stored.
HTML Syntax | HTML Script | Web Display |
---|---|---|
<img src="url"> |
<img src="smiley.gif"> |
smiley.gif
” has the URL:
http://undcemcs01.und.edu/~wen.chen.hu/figure/smiley.gifThe browser puts the image where the image tag occurs in the document. If you put an image tag between two paragraphs, the browser shows the first paragraph, then the image, and then the second paragraph.
The alt Attribute
|
|
alt
attribute is used to define an “alternate text” for an image.
The value of the alt
attribute is an author-defined text.
The attribute tells the reader what he/she is missing on a page if the browser can not load images.
The browser will then display the alternate text instead of the image.
Including the alt attribute for each image can improve the display and usefulness of your document for people who have text-only browsers.
|
|