HTML <source> with sizes Attribute

You are Here:

HTML <source> with sizes Attribute

The sizes attribute specifies the final rendered width of the image represented by the source.

Note: The sizes attribute has an effect only when the <source> element is the direct child of a <picture> element.

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <picture> <source media="(min-width: 660px)" sizes="50vw" srcset="devices.jpg 400w"> <source media="(min-width: 475px)" sizes="75vw" srcset="macbook.jpg 300w"> <source media="(min-width: 385px)" sizes="100vw" srcset="ipad.jpg 200w"> <img src="iphone.jpg" alt="apple iphone" style="width:auto;"> </picture> </body> </html>

Attribute Value

ValueExplanation
pxSpecifies the final rendered width of the image represented by the source..

Reminder

Hi Developers, we almost covered 99.5% of HTML Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in HTML.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author