responsive-images

Safari not requesting srcset images on resize

懵懂的女人 提交于 2019-12-10 17:14:32
问题 I want to provide responsive images, for that I use srcset attribute. <img src="https://res.cloudinary.com/demo/image/upload/w_480/group.jpg" alt="" srcset=" https://res.cloudinary.com/demo/image/upload/w_480/group.jpg 480w, https://res.cloudinary.com/demo/image/upload/w_750/group.jpg 750w, https://res.cloudinary.com/demo/image/upload/w_1334/group.jpg 1334w, https://res.cloudinary.com/demo/image/upload/w_1536/group.jpg 1536w, https://res.cloudinary.com/demo/image/upload/w_2048/group.jpg 2048w

Can I use `<img srcset>` or `<picture>` for image size rather than viewport size?

China☆狼群 提交于 2019-12-10 10:31:39
问题 I'm trying to use <img srcset /> to load images based on the size they'll appear on the page, rather than based on the size of the viewport. Perhaps examples will help: On any viewport, when the image is styled with width: 100% inside a 200px-wide <div> , img-200.jpg should load. On any viewport, when the image is styled with width: 100% inside a 400px -wide <div> , img-400.jpg should load. ...etc. I've done tons of Googling, but as best as I can tell, srcset is only used for changing images

Responsive img/srcset/sizes: Different jpg quality depending on device pixel density?

拈花ヽ惹草 提交于 2019-12-07 14:24:37
问题 I am looking for a responsive image strategy that allows to serve different jpg quality based on the device pixel density. On a small screen with high resolution, I would serve a low-quality but high-resolution jpg. On a big screen with low pixel density, I would serve a high-quality jpg, ideally matching the device resolution. QUESTION: Is this somehow possible with <img srcset=".." sizes=".." /> ? Background / scenario Different original images with different original dimensions. Different

Can I use `<img srcset>` or `<picture>` for image size rather than viewport size?

孤者浪人 提交于 2019-12-06 12:46:49
I'm trying to use <img srcset /> to load images based on the size they'll appear on the page, rather than based on the size of the viewport. Perhaps examples will help: On any viewport, when the image is styled with width: 100% inside a 200px-wide <div> , img-200.jpg should load. On any viewport, when the image is styled with width: 100% inside a 400px -wide <div> , img-400.jpg should load. ...etc. I've done tons of Googling, but as best as I can tell, srcset is only used for changing images based on viewport size, not image size, if that makes sense. Is that correct? Or is there hope for what

Image height inside flexbox not working in Chrome

好久不见. 提交于 2019-12-05 13:52:33
I have a div using flexbox to center its items. Inside this div I have 3 elements, one of them is an image. <div id="flex-container"> <div id="container1"></div> <img src="#" alt=""> <div id="container2"></div> </div> #container1 and #container2 have their own height, and the img should use the remaining height inside #flex-container . This snippet works on Firefox , but doesn't work in Chrome . ( jsfiddle ) #flex-container{ height: 300px; width: 500px; display: flex; display: -webkit-flex; flex-flow: column nowrap; -webkit-flex-flow: column nowrap; justify-content: center; -webkit-justify

bootstrap 4 img-fluid does not change image height

老子叫甜甜 提交于 2019-12-05 11:51:58
问题 Responsive Images in Bootstrap 4, with class .img-fluid are resized disproportionally. They keep it's height even width is shrinking down correctly. That is deforming whole image. Is there any way how to make it as smooth as it was in Bootstrap 3 with class .img-responsive? Thanks <div class="col-sm-6"> <img class="img-fluid" src="/assets/blogs/14853991244821.jpg" alt=""> </div> By the way it is same in Bootstrap 4 documentation (https://v4-alpha.getbootstrap.com/content/images/) where sample

bootstrap 4 img-fluid does not change image height

亡梦爱人 提交于 2019-12-04 01:23:50
Responsive Images in Bootstrap 4, with class .img-fluid are resized disproportionally. They keep it's height even width is shrinking down correctly. That is deforming whole image. Is there any way how to make it as smooth as it was in Bootstrap 3 with class .img-responsive? Thanks <div class="col-sm-6"> <img class="img-fluid" src="/assets/blogs/14853991244821.jpg" alt=""> </div> By the way it is same in Bootstrap 4 documentation ( https://v4-alpha.getbootstrap.com/content/images/ ) where sample svg image keeps height 250 pixels regardless of it's width. The problem was I wrapped image in div

Picturefill and lazyloading with lazysizes

与世无争的帅哥 提交于 2019-12-03 17:09:58
I'm trying to get lazyloading with lazysizes and picturefill to work. The lazyloading itself works if I just use a basic image: <img class=lazyload data-srcset="http://placehold.it/301x301"> If I check the network tab in chrome, I can see that the image was loaded after the red line, so everything is fine: Now I added a <picture> element with my responsive images and try to load that also lazy: <picture> <!--[if IE 9]><video style="display: none;"><![endif]--> <source srcset="http://placehold.it/1370x301 1x, http://placehold.it/2055x450 2x" media="(min-width: 1024px)" /> <source srcset="http:/

Get the current image source of a picture element

守給你的承諾、 提交于 2019-12-01 04:38:45
问题 An HTMLImageElement has a currentSrc property so we can get the current source of an img element. Useful when defining multiple possible sources with srcset . There seems to be no equivalent for an HTMLPictureElement. Is there another way we can find the current source of a picture element with Javascript? 回答1: You can access the currentSrc of the img element within a picture element to get the applied image. In the demo below (if you're on a desktop with your browser full-width) the

image is not resizing in a flexbox layout

╄→尐↘猪︶ㄣ 提交于 2019-11-30 15:42:32
问题 I tried to follow the advice in this answer, and as shown in this CodePen, but the image that needs to flex is still keeping its original dimensions unless the screen is so narrow it is alone on the row. There is another set of divs in the real page in a similar situation - it would help the page work across a much larger range of widths if the side divs would shrink. The div it is wrapped in has flex: auto; on it and img {width: 90%; height: auto;} for any image in it, the parent of that div