I notice Dreamweaver creates a name
attribute automatically with the same value as id
, which I wouldn't have thought to do. I read this question asking the difference between name
and id
attributes in HTML, but what about where it applies to images?

- 1
- 1

- 3,557
- 5
- 37
- 53
-
2One tip: always clean up the code Dreamweaver generates for you. Not only will your code look better afterwards, you should also learn something useful from it. – Stephan Muller Sep 21 '10 at 08:08
4 Answers
Expando attributes won't hurt anything in any modern browser. It was officially supported in HTML 4.01, but removed in Strict XHTML:
Regardless, it is pretty much useless for anything. Dreamweaver has included it for as long as I can remember.
A validator will complain (legitimately so) if you add an unsupported attribute to a tag.

- 53,671
- 14
- 120
- 163
-
-
1For information about standards, it's always best to go to the source. http://w3.org :) – deceze Sep 21 '10 at 08:12
-
HTML 4 didn't include it. HTML 4.01 did. XHTML removed it. Note section C.8: http://www.w3.org/TR/xhtml1/. +1 for the standards recommendation. – Tim M. Sep 21 '10 at 08:14
name
is an attribute included for scripting backwards compatibility and should be of no use today.
http://www.w3.org/TR/html401/struct/objects.html#edef-IMG
name = cdata [CI]
This attribute names the element so that it may be referred to from style sheets or scripts. Note: This attribute has been included for backwards compatibility. Applications should use theid
attribute to identify elements.

- 510,633
- 85
- 743
- 889
Name is pretty much only useful for forms. You can use it as a way to add metadata to images, but there are more standard ways to do that these days.

- 21,295
- 1
- 48
- 66
ID attribute should be used for now.
The NAME attribute, added to IMG in HTML 4.01, specifies a name for referring to the image from a client-side script. The ID attribute provides the same functionality, but old browsers such as Netscape 4.x only support the NAME attribute.
Source: http://htmlhelp.com/reference/html40/special/img.html

- 13,909
- 12
- 65
- 76