Hosting Solutions
mobile_logo Table of Contents
seal_frontseal_back

img

The <img> element is used to display images. It can nest into <a> or <button> elements to make image links. They can also be given an onclick event(among other events) to give them interactive or navigational behavior using JavaScript.

Code Example

<img src="my_pic.jpg" alt="My Picture"> open in code editor

Attributes

globals - the global attributes common to all elements possible values: see global attribute list alt - specify fallback text for missing images possible values: "string" src - specify the path to the image file possible values: "path/to/file" srcset - specify a comma separated image candidate source set possible values: "url, url, url..." crossorigin - specify whether or not to allow images from third party sites possible values: "anonymous", "use-credentials" usemap - specify a <map> element to tie to the image possible values: "the map name attribute value" ismap - specify access to a server side image map for an <img> nested in <a> only possible values: "ismap" width - specify the width of the image possible values: "integer", "percentage" height - specify the height of the image possible values: "integer", "percentage"

Official Documentation

http://www.w3.org/TR/html/embedded-content-0.html#the-img-element

HTML

Elements

aabbraddressareaasidearticleaudiobbasebdobdiblockquotebodybrbuttoncanvascaptioncitecodecolcolgroupdatadatalistdddeldetailsdfndialogdivdldtemembedfieldsetfigcaptionfigurefooterformh1 h2 h3 h4 h5 h6headheaderhrhtmliiframeimginputinskbdkeygenlabellegendlilinkmainmapmarkmetameternavnoscriptobjectoloptgroupoptionoutputpparampreprogressqrb rp rt rtc rubyssampscriptsectionselectsmallsourcespanstrongstylesub supsummarytabletbodytdtemplatetextareatfootththeadtimetitletrtrackuulvarvideowbr