Arteqo Consulting

The European Web Agency

Design, brand and digital development


×

Arteqo Consulting Services

Contact Arteqo

×
I have read and accept the terms and conditions

img tag

The img tag, which, when implemented in the code, is written like this - <img>, is an HTML tag that belongs to image tags. Image HTML tags are used to insert images and their parts, including more interactive visuals, e.g. HTML maps and their clickable areas, captions for figures etc.

<img> inserts a user-specified image. This tag is supported in the current version of HTML, which is HTML5.

Browser support

Here you can see whether <img> is supported by a certain browser, and, if yes, starting from which version it is supported.

Browser support for <img>
ChromeFirefoxEdgeOperaSafari
Is supportedIs supportedIs supportedIs supportedIs supported

Attributes and values

An attribute is a piece of additional information about a tag. While tags denote the type of objects they mark or create, attributes set the parameters of these objects. These parameters can include anything from the types of possible interactions to its visual style to its actual contents.

Values indicate how a certain attribute is actually implemented, if there is a number of ways it can happen.

What attributes are actually allowed in a certain tag depends on the tag itself. Much like possible attributes depend on a tag, possible values depend on an attribute.

The <img> tag supports the following attributes (with their respective values):

AttributeValueDescription
align
  • top
  • bottom
  • middle
  • left
  • right
Specifies the alignment of an image according to surrounding elements
alttextSpecifies an alternate text for an image
borderpixelsSpecifies the width of the border around an image
crossorigin
  • anonymous
  • use-credentials
Allow images from third-party sites that allow cross-origin access to be used with canvas
heightpixelsSpecifies the height of an image
hspacepixelsSpecifies the whitespace on left and right side of an image
ismapismapSpecifies an image as a server-side image-map
longdescURLSpecifies a URL to a detailed description of an image
srcURLSpecifies the URL of an image
URLURLSpecifies the URL of the image to use in different situations
#mapname#mapnameSpecifies an image as a client-side image-map
pixelspixelsSpecifies the width of an image

Global Attributes

Global attributes are HTML tag attributes that can be used by any tag, hence the name "global". They are in contrast to unique attributes that are tag-specific.

<img> supports global attributes.

Event Attributes

Event attributes are HTML tag attributes that allow triggering actions upon specific conditions, hence the name "event". Other types of attributes, namely global and unique attributes, can also trigger actions, but the difference is that even attributes allow calling scripts, such as JavaScript functions, while most other attributes only support a certain type of action.

<img> supports event attributes.