Attribute of
<img>
What does <img name=""> do?
Identified the image or provided additional information about it. Deprecated in HTML 4.0 in favor of other attributes.

Code Example

<!-- DEPRECATED. Do not do this. -->

<img src="/wp-content/uploads/flamingo.jpg" name="Flamingo">

How to Identify Images

The name attribute was originally used to identify images, but it has been deprecated since HTML 4.0. There are several other options for providing a unique name to an image:

  • id — A global attribute that must be unique.
  • title — A global element, which is often displayed in a tooltip when the user hovers over an element.
  • alt — An attribute of <img>, which is displayed when the image cannot be seen, and is used by some image-based search engines.

Other name attributes

While name attribute has been deprecated for the <img> element, it is still used for form input elements, where it defines the key in a key-value pair representing the input when the form is submitted.