With HTML you can display images in a document.
This example demonstrates how to display images in your Web page.
Insert images from different
This example demonstrates how to display images from another folder or another
server in your Web page.
(You can find more examples at the bottom of this page)
The Image Tag and the Src Attribute
In HTML, images are defined with the <img> tag.
The <img> tag is empty, which means that it contains attributes
only and it 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 of defining an image:
The URL points to the location where the image is stored. An image named "boat.gif" located in the directory
"images" on "www.w3schools.com" has the URL:
The 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
The Alt Attribute
The alt attribute is used to define an "alternate text" for an image. The value of
the alt attribute is an author-defined text:
<img src="boat.gif" alt="Big Boat">
The "alt" attribute tells the reader what he or she is missing on a
page if the browser can't load images. The browser will then display the
alternate text instead of the image. It is a good practice to include the
"alt" attribute for each image on a page, to improve the display and usefulness of your document for people who
have text-only browsers.
Basic Notes - Useful Tips
If an HTML file contains ten images - eleven files are required to display the page
right. Loading images take time, so my best advice is: Use images carefully.
This example demonstrates how to add a background image to an HTML page.
This example demonstrates how to align an image within the text.
Let the image float
This example demonstrates how to let an image float to the left or right of a
Adjust images to different
This example demonstrates how to adjust images to different sizes.
Display an alternate text for an
This example demonstrates how to display an alternate text for an image. The "alt" attribute tells the
reader what he or she is missing on a page if the browser can't load images. It is a
good practice to include the "alt" attribute for each image on a page.
Make a hyperlink of an image
This example demonstrates how to use an image as a link.
Create an image map
This example demonstrates how to create an image map, with clickable regions.
Each of the regions is a hyperlink.
Turn an image into an image map
This example demonstrates how to turn an image into an image map. You will see
that if you move the mouse over the image, the coordinates will be displayed on the status bar.
||Defines an image
||Defines an image map
||Defines a clickable area inside an image map
Reliable, affordable, feature-rich web hosting!
Take the uncertainty out of Web hosting and let
put service, performance and value back in. No matter which
hosting type or plan you choose, your site receives 24/7
maintenance and protection in our world-class data center. Plus,
you get the expert, friendly service you deserve, from the
world's largest hostname provider.
With three plans to choose from and
prices starting at just $4.99 per month, GoDaddy.com is sure to have a plan that's
right-sized and right-priced just for you!
All plans feature FREE 24x7 setup, FREE 24x7 monitoring, best-
of-breed routers, firewalls and servers, 24x7 onsite physical security
and access to our exclusive Go Daddy Hosting Connection, THE place
to install over 30 FREE applications. Virtual Dedicated and Dedicated
Server plans also available.
Visit GoDaddy.com today.
Virtual Dedicated, Dedicated Server and unlimited plans also available.
Save 10% on web hosting - Enter code w3tenoff at checkout
Get Your Diploma!
W3Schools' Online Certification Program is the perfect solution for busy
professionals who need to balance work, family, and career building.
The HTML Certificate is for developers who want to document their knowledge of HTML, XHTML, and CSS.
The XML Certificate is for developers who want to document their knowledge of XML, XML DOM and XSLT.
The ASP Certificate is for developers who want to document their knowledge of ASP, SQL, and ADO.
The PHP Certificate is for developers who want to document their knowledge of PHP and SQL (MySQL).