html - Responsive image mapping does not work to scaled images -
i use picturefill.js responsive image feature. when place original image without specifying height , width, image shown in <picture>
tag , pull different size of same images according screen size.
but when specify height , width, responsive feature not work. image loaded <img>
tag.
the documentation of library explains should manage image size using sizes tag:
<img sizes="(min-width: 40em) 80vw, 100vw" srcset="examples/images/medium.jpg 375w, examples/images/large.jpg 480w, examples/images/extralarge.jpg 768w" alt="…">
by defining style width , height forcing image keep aspect.
from site:
the sizes syntax used define spaces image occupy in layout. srcset defines list of images , inherent widths. allows browser choose smallest appropriate source size available in part of layout, rather viewport size alone.
Comments
Post a Comment