img (HTML5)

Defines an image object that is embedded in the document.

Properties & Events

KeyDescriptionAvailability
alignDefines the alignment of the element.
chrome 1.0safari 1.0Firefox 1.0ie 2.0opera 4.0
altSpecifies alternative text to display if the element cannot be displayed as expected.
chrome 1.0safari 1.0Firefox 1.0ie 2.0opera 4.0
borderWidth (in pixels) of the border around the element.
chrome 1.0safari 1.0Firefox 1.0ie 2.0opera 4.0
classCSS class assigned to the element.
chrome 1.0safari 1.0Firefox 1.0ie 1.0opera 1.0
dirDirection of the element text.
chrome 1.0safari 1.0Firefox 1.0ie 2.0opera 4.0
heightHeight of the element (in pixels).
chrome 1.0safari 1.0Firefox 1.0ie 1.0opera 1.0
hspaceNumber of pixels of space to the left and right of the element (i.e. horizontal margin).
chrome 1.0safari 1.0Firefox 1.0ie 2.0opera 4.0
idUnique identifier for the element.
chrome 1.0safari 1.0Firefox 1.0ie 1.0opera 1.0
langLanguage code for the content of the element.
chrome 1.0safari 1.0Firefox 1.0ie 2.0opera 4.0
languageScript language for the element.
chrome 1.0safari 1.0Firefox 1.0ie 3.0opera ??
longdescURL that contains a long description of the contents of the element.
chrome 1.0safari 1.0Firefox 1.0ie 4.0opera 4.0
srcURL for the source for the element.
chrome 1.0safari 1.0Firefox 1.0ie 2.0opera 1.0
styleInline style for the element.
chrome 1.0safari 1.0Firefox 1.0ie 1.0opera 1.0
tabindexPosition of the element in the tabbing order for the document.
chrome 1.0safari 1.0Firefox 1.0ie 2.0opera 4.0
titleShort text description for the element.
chrome 1.0safari 1.0Firefox 1.0ie 1.0opera 1.0
usemapSpecifies a URL to use for an image map or object map.
chrome 1.0safari 1.0Firefox 1.0ie 2.0opera 4.0
vspaceNumber of pixels of space above and below the element (i.e. vertical margin).
chrome 1.0safari 1.0Firefox 1.0ie 2.0opera 7.0
widthWidth of the element (pixels or percentage).
chrome 1.0safari 1.0Firefox 1.0ie 1.0opera 1.0
onblurFires when the element loses focus.
chrome 1.0safari 1.0Firefox 1.0ie 2.0opera 4.0
onclickFires when the element is clicked.
chrome 1.0safari 1.0Firefox 1.0ie 2.0opera 4.0
ondblclickFires when the element is double-clicked.
chrome 1.0safari 1.0Firefox 1.0ie 2.0opera 4.0
onfocusFires when the element receives focus.
chrome 1.0safari 1.0Firefox 1.0ie 2.0opera 4.0
onkeydownFires when a user presses down on a key while the element has focus.
chrome 1.0safari 1.0Firefox 1.0ie 2.0opera 4.0
onkeypressFires when a user presses a key or holds down the key while the element has focus.
chrome 1.0safari 1.0Firefox 1.0ie 2.0opera 4.0
onkeyupFires when a user releases a key while the element has focus.
chrome 1.0safari 1.0Firefox 1.0ie 2.0opera 4.0
onmousedownFires when a user clicks down on the mouse button while the element has focus.
chrome 1.0safari 1.0Firefox 1.0ie 2.0opera 4.0
onmousemoveFires when the mouse moves while the pointer over the element.
chrome 1.0safari 1.0Firefox 1.0ie 2.0opera 4.0
onmouseoutFires when the mouse pointer moves off of the element.
chrome 1.0safari 1.0Firefox 1.0ie 2.0opera 4.0
onmouseoverFires when the mouse pointer moves over the element.
chrome 1.0safari 1.0Firefox 1.0ie 2.0opera 4.0
onmouseupFires when the user releases the mouse button while the element has focus.
chrome 1.0safari 1.0Firefox 1.0ie 2.0opera 4.0

Examples having uses of: 'img'

0 votes
10k views

CSS Floating Images

In this example, four thumbnails are floating below heading. Try to resize the browser window to see how the float to the right.
1 votes
10k views

HTML Image

Images with title and borders
0 votes
3k views

HTML5 Drag and Drop between four elements

Drag and Drop magic with HTML5 using an image to drag back and forth between four <div> elements.
4 votes
2k views

HTML Image

This HTML element indicates a media object to include in an HTML document. Usually, the object is a graphic image like the smiley :)
0 votes
2k views

CSS Ease in and Ease out

CSS3 transitions are effects that let an element gradually change from one style to another. To do this, you must specify the effect and the duration.
1 votes
2k views

HTML Image Resize

The height and width attributes are used to specify the height and width of an image and the attribute values are specified in pixels by default. Tip: It is a good practice to specify both the height and width attributes for an image.
0 votes
1k views

HTML image link

If you want to make an image work as a link, the method is exactly the same as with texts. You simply place the <a href> and the </a> tags on each side of the image.
0 votes
1k views

CSS Layers Overlapping

This example uses "z-index:100" to place an image above the text. Try to change z-index to -1 and see the image fall behind the text.
0 votes
1k views

CSS Vertical Align

The vertical-align property sets the vertical alignment of an element.