TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

How to think about HTML responsive images

201 pointsby danburzoabout 1 year ago

12 comments

fifticonabout 1 year ago
One frequent unpleasant side-effect of responsive design, is sites that resize themselves when you try to zoom the page. For images, this sometimes turns bizarre: If you try to zoom the current webpage to more clearly see details of an image, the web page will try to "help" you by resizing the image to continue to fit in your viewport. The net result is, that the image often gets even smaller when you try to zoom (because neighbour elements like text still grows). Reddit is one of the sites guilty of this. Worse, they even do it if you "open image in new tab". I have surrendered on this, and instead just DOWNLOAD the image to disk, to then reopen it in a separate tab, to finally zoom it.. Sigh.
评论 #39977321 未加载
评论 #39978206 未加载
评论 #39978211 未加载
评论 #39976893 未加载
评论 #39978223 未加载
评论 #39978591 未加载
评论 #39979823 未加载
评论 #39978197 未加载
frankzanderabout 1 year ago
To be honest ... this is IMHO by far one of the most complicated thing in the whole webdev area. I don&#x27;t get it why ppl complain about how difficult CSS is ... but to foresee how an image behaves and find a good balance between size and file size is a hart thing to juggle with.<p>This article clarifies a lot of things for me so thx for that.
评论 #39976890 未加载
评论 #39978796 未加载
评论 #39976919 未加载
nicbouabout 1 year ago
Well done! Having read the source documents a few times, I wish that your article existed before. It took me a while to wrap my head around the concepts and to get them to work properly.
评论 #39976977 未加载
Lorinabout 1 year ago
I have no idea why browsers moved away from providing the DPR (device pixel ratio) header on media requests so one could continue using the sensible and simple &lt;img&gt; whilst the server could return the correct images on its own.<p>Would love to know the rationale.
评论 #39977060 未加载
评论 #39976762 未加载
评论 #39978762 未加载
评论 #39976770 未加载
评论 #39976922 未加载
liampullesabout 1 year ago
I like the approach of displaying a smaller compressed version and enclosing the img in an a tag to link to the larger image.<p>Let me load the page quickly if the doggo is just being used as an aside to the main content. Let me click on it to get the full raw image if I&#x27;m so enticed by that over the shoulder glance.
estabout 1 year ago
Is it possible to serve <i>one</i> image file of progressive encoding and display different size on different media conditions?<p>As a hack I would just put the blob offset in the URL as part of file name, and use js to load those images.<p>For example:<p>filename.1000-120w.3000-240w.5000-360w.jpg<p>means the 0-1000 bytes will get you 120w image, 0-3000 bytes will get you the 240w image, 0-5000 bytes will get you the 360w image, and load full will get you the original image. Make an http request with a Content-Range header and render the result with canvas or something.
评论 #39982501 未加载
评论 #39978826 未加载
评论 #39977465 未加载
orliesaurusabout 1 year ago
Looks like the verbose &lt;picture&gt; approach would be the most advantageous for backwards and forwards compatibility
评论 #39976434 未加载
perardiabout 1 year ago
I just have to compliment the lovely external link motif here.
评论 #39976707 未加载
victorbjorklundabout 1 year ago
Well-written. Will def come back to this.
评论 #39976963 未加载
troupoabout 1 year ago
So, the question remains: how do I supply various dynamic densities in different formats?
评论 #39976933 未加载
knallfroschabout 1 year ago
Now you just need to know at which size your image will be displayed at in a flex container and you&#x27;re done :))
ryebread777about 1 year ago
Very helpful! I will come back to read more deeply. But in general, what approach would you recommend?
评论 #39977077 未加载