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.
Reliable, affordable, feature-rich web hosting!
Take the uncertainty out of Web hosting and let
GoDaddy.com
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 JavaScript Certificate is for developers who want to document their knowledge of JavaScript and the HTML DOM.
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).
|
|