type attribute | type property
Specifies the file type of the images in the source set. This allows the user agent to skip to the next source element if it does not support the given type.
Syntax
| HTML |
|---|
<element type="p" ... > |
Property values
Type: String
A string that represents the MIME type of the images in the source set. An example would be "image/jpeg".
Standards information
Remarks
The string parameter must be a valid MIME type.
Examples
In the example below, the user agent uses the type attribute to determine the file type of the images in the srcset. If .png is not supported, the fallback image is displayed.
<picture> <source srcset="example.png" type="image/png"> <img src="fallback.jpeg"> </picture>
See also
Show: