w3-video.com logo

HTML5 Tutorial

Home HTML5 XAMPP .htaccess Firefox Notepad++

Share it



img class attribute

The class attribute on the img element:


Learn to ensure your website's cross browser compatibility »video.

Examples

<imgattribute="value(s)" >Examples
2.class=class name<img src="image.jpg" alt="alt text" class="class_name">

"class_name" = the value of the class attribute
"class_name" = the name of a defined CSS class inside an internal ⁄ external style sheet

Video demonstration img class attribute

HTML5 img class attribute Tutorial

min video details
00:05 video tutorial: class attribute on img
00:11 inside style element, we defined 1 CSS rule for elements having the class="bd"
00:17 multiple images are embedded into our document
00:23 let's apply this css rule to the 2nd image
00:44 the 2nd image has now a 4px outset border
00:54 the same class can be added on multiple elements on the same page → the CSS rule(s) corresponding to that class will apply to all those elements
01:02 the 1st and 3rd image have now a 4px purple outset border
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 draggable attributeimg hidden attributeimg id attributeimg lang attributeimg style attributeimg tabindex attributeimg title attributeimg translate attribute