MaraHTML
Coding resources, tutorials and more.
HTML Images
Share this page:
To add an image to the page you need to use an <img> element, this is an empty element (no closing tag). It must at the very least have the src attribute. This tells the browser the url of the image.
<img src="http://images.marapets.com/top/top_gallery.png">
Other attributes
height: This specifies the height in pixels.
width: This specifies the width in pixels.
<img src="http://images.marapets.com/top/top_gallery.png" height="200px" width="200px">
NOTE: Increasingly the size of an image is being specified using CSS rather than HTML, this is very useful if you want to change the size of a range of images. It's recommended to specify the size of the image even if you're going to use the default size, otherwise the page will flicker while it loads.
alt:This gives at text description of the image if it can't be seen.
<img src="http://images.marapets.com/_/top_gallery.png" alt="*This image url is broken*!">
title:This gives a text description as a tooltip.
<img src="http://images.marapets.com/top/top_gallery.png" title="Gallery image icon">