w3-video.com logo

HTML5 Tutorial

Home HTML5 XAMPP .htaccess Firefox Notepad++

Share it

img id attribute

The id attribute on the img element:


<imgattribute="value(s)" >Examples
10.id=id name<img src="image.jpg" alt="alt text" id="ax">

"ax" = this value is unique per id per HTML page
(only 1 id attribute can have this value / HTML page)

Video demonstration img id attribute

HTML5 img id attribute Tutorial

min video details
00:05 video tutorial: id attribute on img
00:10 the id attribute on img allows you to target 1 specific image on page and do something: apply a script, a css rule, link an element to that image
00:16 3 images are embedded on page
00:23 inside style element 2 css rules are defined: 1 rule / CSS id selector
00:28 the CSS rules refer to the type of the cursor: e-resize and wait; we will apply these rules to our images
00:32 by default the cursor type is: auto;
00:53 the cursor type for the first image is: e-resize
00:59 since an id is an unique identifier, the value of an id must be unique per page
01:03 2 ids have the same value per page → this is wrong !
01:12 the 2 ids have different values → this is correct
01:08 thus, we have:
1st image cursor type: e-resize
2nd image cursor type: wait
3rd image cursor type: auto
img intro img optional img occurrences img browser display img parents server-side image map (ismap) vs client-side image map (usemap) img syntaximg alt attributeimg ismap attributeimg usemap attributeimg width, height attributesimg src attributeimg accesskey attributeimg class attributeimg draggable attributeimg hidden attributeimg lang attributeimg style attributeimg tabindex attributeimg title attributeimg translate attribute