picture tag
The picture tag, which, when implemented in the code, is written like this - <picture>, 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.
<picture> gives web developers more flexibility in specifying image resources. The <picture> element holds two different tags: one or more <source> tags and one <img> tag. This tag is supported in the current version of HTML, which is HTML5.
Browser support
Here you can see whether <picture> is supported by a certain browser, and, if yes, starting from which version it is supported.
Chrome | Firefox | Edge | Opera | Safari |
---|---|---|---|---|
Supported since Chrome v38 | Supported since Firefox v38 | Supported since Edge v13 | Supported since Opera v25 | Supported since Safari v9.1 |
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 <picture> tag does not support any attributes.
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.
<picture> 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.
<picture> supports event attributes.