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,545
- 3
- 34
- 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.
- 52,666
- 12
- 118
- 157
-
-
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 theidattribute to identify elements.
- 491,798
- 79
- 706
- 853
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.
- 20,877
- 1
- 46
- 65
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,711
- 12
- 63
- 74