HTML 5 img tag

From http://www.w3schools.com (Copyright Refsnes Data)

# HTML 5 <img> tag

## Definition and Usage

The img element defines an image.

## Differences Between HTML 4.01 and HTML 5

The "align", "border", "hspace", and "vspace" attributes of the image element were deprecated in HTML 4.01, and are no longer supported in HTML 5.

## Example

Source | Output
--- | ---
<img src="angry.gif" alt="Angry" /> |

## Attributes

- 4: indicates if the attribute is defined in HTML 4.01
- 5: indicates if the attribute is defined in HTML 5

Attribute | Value | Description | 4 | 5
--- | --- | --- | --- | ---
alt | text | Defines a short description of the image | 4 | 5
src | URL | The URL of the image to display | 4 | 5
align | top bottom middle left right | Specifies how to align the image according to surrounding text. Not supported. Use CSS instead | 4 |
border | pixels | Defines a border around an image. Not supported. Use CSS instead | 4 |
height | pixels % | Defines the height of an image | 4 | 5
hspace | pixels | Defines white space on the left and right side of the image. Not supported. Use CSS instead | 4 |
ismap | URL | Defines the image as a server-side image map | 4 | 5
longdesc | URL | A URL to a document that contains a long description of the image. Not supported | 4 |
usemap | URL | Defines the image as a client-side image map. Look at the <map> and <area> tags to figure out how it works | 4 | 5
vspace | pixels | Defines white space on the top and bottom of the image. Deprecated. Use styles instead | 4 | 5
width | pixels % | Sets the width of an image | 4 | 5

## Standard Attributes

class, contenteditable, contextmenu, dir, draggable, id, irrelevant, lang, ref, registrationmark, tabindex, template, title

For a full description, go to Standard Attributes in HTML 5.

## Event Attributes

onabort, onbeforeunload, onblur, onchange, onclick, oncontextmenu, ondblclick, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onerror, onfocus, onkeydown, onkeypress, onkeyup, onload, onmessage, onmousedown, onmousemove, onmouseover, onmouseout, onmouseup, onmousewheel, onresize, onscroll, onselect, onsubmit, onunload

For a full description, go to Event Attributes in HTML 5.

## Try-It-Yourself Demos

Insert images
How to display images in your Web page.

Insert images from different locations
How to display images from another folder or another server in your Web page.

Let the image float
How to let an image float to the left or right of a paragraph.

Adjust an image to different sizes
How to adjust an image to different sizes.

Make a hyperlink of an image
How to use an image as a link.

Create an image map
How to create an image map, with clickable regions. Each region is a hyperlink.

From http://www.w3schools.com (Copyright Refsnes Data)