Horje

How to add HTML <img> srcset Attribute

The srcset attribute on an <img> tag specifies multiple image resources (URLs) for the img element.

Together with the sizes attribute they create responsive images that adjust according to browser conditions.

A srcset attribute on an <img> element.
Resizing the browser will adjust the image file used.

index.html
Example: HTML
<img srcset="https://horje.com/avatar.png 120w,
             https://horje.com/avatar.png 193w,
             https://horje.com/avatar.png 278w"
     sizes="(max-width: 710px) 120px,
            (max-width: 991px) 193px,
            278px">

Output should be:

How to add HTML <img> srcset Attribute




Type:
html
Category:
Web Tutorial
Sub Category:
HTML Tag
Uploaded by:
Admin