How to make images responsive using srcset and size attribute??

I have tried using srcset but it isnt working the demo link line 37 https://github.com/kvandana451/Assorted-Cards-images/blob/main/index.html
GitHub
Assorted-Cards-images/index.html at main · kvandana451/Assorted-Car...
A card layout with various sizes, containing images and/or text. - kvandana451/Assorted-Cards-images
321 Replies
ἔρως
ἔρως6mo ago
i have no idea why this doesn't work. do you have any way to test this with a real device?
ἔρως
ἔρως6mo ago
i tried this on my android 9 phone, and i have no idea why it doesn't work
No description
ἔρως
ἔρως6mo ago
it should work
Vandana
VandanaOP6mo ago
Trying. ITS WORKING ACTUALLY
ἔρως
ἔρως6mo ago
how did you checked it?
Vandana
VandanaOP6mo ago
Properties and then currentSrc which i have highlighted
No description
ἔρως
ἔρως6mo ago
that is interesting 🤔 this begs the question: is this another bug where the image is loaded but isn't showing in the network?
Vandana
VandanaOP6mo ago
No now it is showing in the network tab as well
ἔρως
ἔρως6mo ago
🤔 i have no clue of what is going on
Vandana
VandanaOP6mo ago
As disscussed in the above, the images seemed too be quiet big, so as suggested we used graphic tools to reduce the file size of the image and display those images depending on the screen size using srcset ,it was not loading in the network tab ,but now those images are loading fine as per the varying screen size we can see the change in images in the network tab .
Vandana
VandanaOP6mo ago
GitHub
GitHub - kvandana451/Assorted-Cards-images: A card layout with vari...
A card layout with various sizes, containing images and/or text. - kvandana451/Assorted-Cards-images
Vandana
VandanaOP6mo ago
I have tried to reduce the file size now you can see the change in the file size.
Kevin Powell
Kevin Powell6mo ago
One thing that can muck up testing with srcset is, if the page loads in the larger one first, it won't load in a smaller one later when the viewport gets smaller. There's no need to change things at that point, because it already has a higher quality image. But yeah, it seems to be working fine now 🙂
Vandana
VandanaOP6mo ago
But i feel only the image file size has been reduced but still images appear gigantic
Kevin Powell
Kevin Powell6mo ago
What do you mean? Like, right now, the rendered images are basically in line with what you want, I think? Like, at small screen sizes, it's loading in the 375 x 250 version of the image. The rendered size is how big it is on the page, the intrinsic size is the actual size of the image.
No description
Vandana
VandanaOP6mo ago
The rendered images are inline since the height is 100% i have set. At small screen size its loading 238 x 192 (i have resized it using graphic tools to reduce the bandwidth and file size) So to say overall evenn though i have reduced the file size, at 320 px still the images are gigantic
Kevin Powell
Kevin Powell6mo ago
I don't understand how the image is gigantic at 375 x 250. It is bigger than rendered size, but it's not that much bigger? I mean, if you wanted, you could create 10 versions, each one slightly bigger than the next, but it would be a waste of time. The image file size is 7kb right now. If you made it 250 wide instead, it would be ~5kb?
Vandana
VandanaOP6mo ago
Exactly. looks gigantic for the users. You can have a look at the images at all screen sizes ..
Kevin Powell
Kevin Powell6mo ago
Well, that's more on the layout than anything else.
Vandana
VandanaOP6mo ago
Meaning the given design?
Kevin Powell
Kevin Powell6mo ago
Yup. It's less about the actual physical size of the image, but the aspect ratio of it, and how much space is available to it.
Vandana
VandanaOP6mo ago
https://codepen.io/abcretrograde/pen/rKOgWw from this i have downloaded the image and implemented .They look so small here.the same imags after i implementing they are gigantic
Stephen Lee
CodePen
Assorted cards & images (CSS Grid + BEM)
A card layout with various sizes, containing images and/or text. Using BEM to try to keep the code organized (and to help keep the design consistent)....
ἔρως
ἔρως6mo ago
i actually didn't knew this, but can confirm that starting with mobile size on the desktop makes it work properly
No description
ἔρως
ἔρως6mo ago
but doesn't explain this... maybe it's one of the weird viewport vs real resolution weirdnesses?
Vandana
VandanaOP6mo ago
Its working actually what is the issue you are facing?? even for large screen as well.....
ἔρως
ἔρως6mo ago
i didn't check again, but i was having issues testing it but i did what kevin said and, on desktop, it loads the 325px version or 350 or whatever
Vandana
VandanaOP6mo ago
but for mobile it loads less than that
ἔρως
ἔρως6mo ago
i will test again
Vandana
VandanaOP6mo ago
yes pls
ἔρως
ἔρως6mo ago
it does load the 375px version, however ... img1-375.webp is 1122x750px
No description
No description
ἔρως
ἔρως6mo ago
wait, i mixed it with image 1 - which is the wrong one
Vandana
VandanaOP6mo ago
could i get an update on this
ἔρως
ἔρως6mo ago
thats my update: the 375px image doesnt have 375 pixels of width that probably is confusing the living hell out of chrome
Vandana
VandanaOP6mo ago
its just the naming for an image not 375px width
ἔρως
ἔρως6mo ago
here's the problem: you're saying it is a 375px wide image, which isn't the reality
No description
Vandana
VandanaOP6mo ago
375w is not the width its the media query
ἔρως
ἔρως6mo ago
it's the intrinsic width of the image
Vandana
VandanaOP6mo ago
true
ἔρως
ἔρως6mo ago
but the real size is 1133 or something
Vandana
VandanaOP6mo ago
yea we have used graphic tools to reduce the file size this was one among the process explained
ἔρως
ἔρως6mo ago
yes, but you downloaded the wrong one
Vandana
VandanaOP6mo ago
there is no other way apart from downloading from inspect
Vandana
VandanaOP6mo ago
No description
ἔρως
ἔρως6mo ago
you downloaded the wrong one from squoosh.app
Vandana
VandanaOP6mo ago
but then i have checked the file size it was less then the original that only i have downloaded
ἔρως
ἔρως6mo ago
because you downloaded a webp the original was a jpeg, which was smaller but you didn't download the one with the low resolution
Vandana
VandanaOP6mo ago
only one img was jpeg rest some were webp only i have downloaded the one which has low file size is that wrong?
ἔρως
ἔρως6mo ago
yes and no i explained why
Vandana
VandanaOP6mo ago
how did you find out this??
ἔρως
ἔρως6mo ago
because of the resolution of the image open it in a new tab and it will show the resolution
Vandana
VandanaOP6mo ago
but then in squoosh app i have set the resolution less than 50% depending upon the clarity only
ἔρως
ἔρως6mo ago
yes, but you downloaded the wrong one, and you're telling chrome that it is a size that it actually isn't
Vandana
VandanaOP6mo ago
ohh! again need to repeat this process
ἔρως
ἔρως6mo ago
yes, and make sure you download the correct one HOWEVER the current img1-375.webp can be used instead of the jpeg BUT!!!! re-do all the process by using the jpeg image, to avoid losing too much quality
Vandana
VandanaOP6mo ago
how to check whether i am downloading the correct one for safety ,because again i dont wanna redo
ἔρως
ἔρως6mo ago
only do changes on the right side of squoosh.app and leave the left side in "original" at all times
Vandana
VandanaOP6mo ago
yea same only i had done
ἔρως
ἔρως6mo ago
you did on both sides
Vandana
VandanaOP6mo ago
and click on the download blue icon at the bottom
ἔρως
ἔρως6mo ago
yes
Vandana
VandanaOP6mo ago
you mean instead of the original given jpeg image use this one(img1-375) for large screen?
ἔρως
ἔρως6mo ago
im saying to use that image for the full size one, on the website, instead of the jpeg one
Vandana
VandanaOP6mo ago
you mean instead of the original given jpeg image use this one(img1-375) for large screen? thats what i ment
ἔρως
ἔρως6mo ago
yes
Vandana
VandanaOP6mo ago
meaning keep the setting for those images at the left side for jpeg,and new image format in jpeg only?
ἔρως
ἔρως6mo ago
no meaning "don't use the jpeg image on the website"
Vandana
VandanaOP6mo ago
thats what left side any format of the given image ,right side jpeg
ἔρως
ἔρως6mo ago
left side is webp
Vandana
VandanaOP6mo ago
but some are jpeg
ἔρως
ἔρως6mo ago
yes, but you can convert them later on
Vandana
VandanaOP6mo ago
No description
Vandana
VandanaOP6mo ago
it comes back to this point only
ἔρως
ἔρως6mo ago
you're encoding it to a jpeg
Vandana
VandanaOP6mo ago
yes whats the issue
ἔρως
ἔρως6mo ago
i don't get the issue you can just change it
Vandana
VandanaOP6mo ago
change it to what?
ἔρως
ἔρως6mo ago
webp
Vandana
VandanaOP6mo ago
oh but then it doesnt solve the pbm
ἔρως
ἔρως6mo ago
im so confused now what are you trying to do?
Vandana
VandanaOP6mo ago
as you said
ἔρως
ἔρως6mo ago
is the original image a webp?
Vandana
VandanaOP6mo ago
ya
ἔρως
ἔρως6mo ago
do you need a smaller version of it?
Vandana
VandanaOP6mo ago
ya becuase you stated the images are very gigantic
ἔρως
ἔρως6mo ago
you're disturbing don't hijack questions just to ask to answer your question that's 2 rule breaks in 1
Vandana
VandanaOP6mo ago
you have explained in the showcase section the same procedure i followed
ἔρως
ἔρως6mo ago
set the output to webp, then resize to 50%, play around with the quality and then export
Stefano
Stefano6mo ago
no need to be aggressive your question will be answered ether way...
ἔρως
ἔρως6mo ago
im not being aggressive 🤔
b1mind
b1mind6mo ago
He is right though you are the one being rude, please take time to consider how you are behaving.
ἔρως
ἔρως6mo ago
is it the lack of "please" and "thank you" that sounds aggressive? 🤔
Stefano
Stefano6mo ago
just nvm. good luck on your query apologies
Vandana
VandanaOP6mo ago
i guess this is pointing out to me
ἔρως
ἔρως6mo ago
no, it was to me i pointed out he's disturbing the flow of this post, and that by asking us to answer his question he's hijaking this and breaking 2 rules
Vandana
VandanaOP6mo ago
first of all this is leading to a big confusion.
ἔρως
ἔρως6mo ago
yes, that's why i said he's disturbing
Vandana
VandanaOP6mo ago
Cool. This was done .
ἔρως
ἔρως6mo ago
then that's it
Vandana
VandanaOP6mo ago
and this was the status
ἔρως
ἔρως6mo ago
alright, 1 second
Vandana
VandanaOP6mo ago
sure
ἔρως
ἔρως6mo ago
i will use this image as an example
No description
Vandana
VandanaOP6mo ago
go ahead
ἔρως
ἔρως6mo ago
i open it in squoosh.app
No description
Vandana
VandanaOP6mo ago
okay
ἔρως
ἔρως6mo ago
resized it and picked these settings
No description
No description
ἔρως
ἔρως6mo ago
then just click the blue button on the bottom right side
Vandana
VandanaOP6mo ago
exactly
ἔρως
ἔρως6mo ago
that's it BUT
Vandana
VandanaOP6mo ago
but what?
ἔρως
ἔρως6mo ago
in this case, since it is a jpeg image, just export as a webp image, and you should save some space automatically
Vandana
VandanaOP6mo ago
ya try implementing the same in your system
ἔρως
ἔρως6mo ago
i've messed about with some settings, and got this
No description
No description
ἔρως
ἔρως6mo ago
but if you just leave it at 75 quality, and convert to webp, you should save 20-30%
Vandana
VandanaOP6mo ago
yea
ἔρως
ἔρως6mo ago
that should be it
Vandana
VandanaOP6mo ago
i too followed the same as per your instructions
ἔρως
ἔρως6mo ago
then you should have 2 webp images
Vandana
VandanaOP6mo ago
how original to new webp image one only .. may be for diff diff screen sizes you are saying?
ἔρως
ἔρως6mo ago
yes, one with the same size as the original version, and one that's 50% the resolution of the original
Vandana
VandanaOP6mo ago
yea check the code its there as you say try reproducing in your system
ἔρως
ἔρως6mo ago
your image has -625 in the name, then you say it is 560px wide, but it's actually 617px of intrinsic width
No description
ἔρως
ἔρως6mo ago
wait, no, that's still the wrong size nevermind.... i am wrong so, chrome does this weird thing where it shows the full size on the url of the half size you are correct: it is 560px, but the name of the file has -625, which will confuse you in the future you should fix that
Vandana
VandanaOP6mo ago
just for urge definetly first i want to get confirmation from your end whether i am doing right
ἔρως
ἔρως6mo ago
you're 90% there you're still using the original jpeg, instead of the full-size webp
Vandana
VandanaOP6mo ago
where pls point out
ἔρως
ἔρως6mo ago
<img srcset="/images/img4-625.jpg 560w,/images/img4.jpeg 1120w" sizes="(max-width: 1220px) 560px, 1120px" src="/images/img4.jpeg" alt="Scenary" class="img-four"> the 1120w path and the src path both point to the jpeg
Vandana
VandanaOP6mo ago
src and 1120w point to original version of the image
ἔρως
ἔρως6mo ago
yes, but should be to a full-size webp image, which saves some space
Vandana
VandanaOP6mo ago
again the squoosh app? to convert to webp
ἔρως
ἔρως6mo ago
yes, but you just change it to webp, and don't resize
Vandana
VandanaOP6mo ago
god!! but aleast at small screen sizes what is happening?
ἔρως
ἔρως6mo ago
it is correct
Vandana
VandanaOP6mo ago
images are gigantic only na for small screen. this is for large screens .got it
ἔρως
ἔρως6mo ago
yes, it is remember: it's only worth it to load the bigger image when the size in css starts to make the image look really bad which should be at about the resolution you have there yeah, about 1220px maybe more, since the image takes 50% of the screen size only
Vandana
VandanaOP6mo ago
what happens if it is of other formats they are full fleged only only for space i need to make the original version of image to webp?
ἔρως
ἔρως6mo ago
yes well, avif looks very horrible, in my opinion it's a video format, and it loses a lot of "texture" it's great in many situations, but ...
ἔρως
ἔρως6mo ago
png will explode the size of the image into ridiculously huge sizes
No description
ἔρως
ἔρως6mo ago
jpegxl will reduce the size of the image by about 30% - but only iphones, ipads and macs support it for now with the right tool, it can be encoded to and from jpeg without losing any quality
No description
ἔρως
ἔρως6mo ago
the rest is just different encoders for jpeg, webp and png
Vandana
VandanaOP6mo ago
ok ok
ἔρως
ἔρως6mo ago
i suggest webp because it (sometimes) reduces a little more than jpegxl and is supported in most/all browsers, despite being super annoying
ἔρως
ἔρως6mo ago
you still have a jpeg image
No description
ἔρως
ἔρως6mo ago
and another one
No description
ἔρως
ἔρως6mo ago
and another one ...
No description
ἔρως
ἔρως6mo ago
you should enable the file extensions on windows
Vandana
VandanaOP6mo ago
this is for the small screen sizes na output should be in jpeg
ἔρως
ἔρως6mo ago
no, it should be in webp because it's smaller
Vandana
VandanaOP6mo ago
..... small screen sizes was set to jpeg.now again should modify to webp?? infact large screen are set to webp only..
ἔρως
ἔρως6mo ago
yes, everything should be webp
Vandana
VandanaOP6mo ago
..
ἔρως
ἔρως6mo ago
it's gross, i know, but it should be webp
Vandana
VandanaOP6mo ago
now pls go through
ἔρως
ἔρως6mo ago
still has jpeg
No description
Vandana
VandanaOP6mo ago
wait a bit it isnt deployed yet
ἔρως
ἔρως6mo ago
alright
Vandana
VandanaOP6mo ago
check
Vandana
VandanaOP6mo ago
No description
ἔρως
ἔρως6mo ago
now it is webp
Vandana
VandanaOP6mo ago
whats the result now? what to conclude images are still big?
ἔρως
ἔρως6mo ago
no, no the media query needs some tweaking, but it is working properly
Vandana
VandanaOP6mo ago
what next?
ἔρως
ἔρως6mo ago
the media queries need tweaking, to take advantage of the small images lets take the image 4 as an example img4-625.webp is 560 pixels wide, and img4.webp is 1120 pixels wide at which resolution(s) the css size of the image is larger than 560px?
Vandana
VandanaOP6mo ago
no size as such here is the proof
Vandana
VandanaOP6mo ago
Stephen Lee
CodePen
Assorted cards & images (CSS Grid + BEM)
A card layout with various sizes, containing images and/or text. Using BEM to try to keep the code organized (and to help keep the design consistent)....
ἔρως
ἔρως6mo ago
that's not true at 1429px, it jumps to 573px and at 1428px, it's 669.94px
Vandana
VandanaOP6mo ago
oh i see
ἔρως
ἔρως6mo ago
it's what the browser says
No description
ἔρως
ἔρως6mo ago
and at 1180 it goes up to 719px
No description
ἔρως
ἔρως6mo ago
in this specific image, i would set the max-width of the media query to 940px
No description
No description
ἔρως
ἔρως6mo ago
all other sizes get the original image
Vandana
VandanaOP6mo ago
944 accurately.. has 561
ἔρως
ἔρως6mo ago
940 has 599.64 pixels wide also, 940 is a "round" number, without that nasty 4 at the end when calculating sizes, the browser rounds up, but, again, 940 is a pretty number
Vandana
VandanaOP6mo ago
okay okay cool
ἔρως
ἔρως6mo ago
but you can use 944 if you want
Vandana
VandanaOP6mo ago
ok then for img1-675 it is 2821px wide
ἔρως
ἔρως6mo ago
yuck, another non-round number 2820px is enough by doing this annoying process, you will save quite a lot in terms of bandwidth
ἔρως
ἔρως6mo ago
currently, you're downloading about 879kb in images, which is quite a lot for the current website
No description
ἔρως
ἔρως6mo ago
i remember it was 1.2mb, which means that you saved about 30% of space
Vandana
VandanaOP6mo ago
actually prior it was more than this i feel initially in one of your explaination.
ἔρως
ἔρως6mo ago
i have a faint idea it was 1.2mb
Vandana
VandanaOP6mo ago
am i right na? great memory exactly
ἔρως
ἔρως6mo ago
im surprised i remembered
Vandana
VandanaOP6mo ago
na i have troubled that much and irriated that is why
ἔρως
ἔρως6mo ago
irritated because of this process? it is a very annoying process, i know
Vandana
VandanaOP6mo ago
i meant you remember its 1.2mb because i have troubled by my queries and irriated you .
ἔρως
ἔρως6mo ago
oh, im not irritated
Vandana
VandanaOP6mo ago
thanks for your patience now completed with tweaking media queries kindly check
ἔρως
ἔρως6mo ago
well, i will annoy you, but ... i think you should swap the order in which the images are loaded
No description
ἔρως
ἔρως6mo ago
so it loads the low quality one and then loads the high quality one when it's bigger instead of this:
<img srcset="/images/img1-625.webp 561w, /images/img1.webp 1122w" sizes="(max-width: 2820px) 561px, 1122px" src="/images/img1.webp" alt="Tower" class="img-one">
<img srcset="/images/img1-625.webp 561w, /images/img1.webp 1122w" sizes="(max-width: 2820px) 561px, 1122px" src="/images/img1.webp" alt="Tower" class="img-one">
probably would be better to write this:
<img srcset="/images/img1-625.webp 561w, /images/img1.webp 1122w" sizes="(min-width: 2820px) 1122px, 561px" src="/images/img1-625.webp" alt="Tower" class="img-one">
<img srcset="/images/img1-625.webp 561w, /images/img1.webp 1122w" sizes="(min-width: 2820px) 1122px, 561px" src="/images/img1-625.webp" alt="Tower" class="img-one">
Vandana
VandanaOP6mo ago
how do we get to know this? is my thinking right that at upto 2820 screen size it loads an img width of 561px which is called low qualtity,becuase the other remaining screen size has 1122px width image (termed as high quality ,because of its higher img widthhh???) both means the same,,,, if i am write in my explaination then,,<img srcset="/images/img1-625.webp 561w, /images/img1.webp 1122w" sizes="(max-width: 2820px) 1122px, 561px" src="/images/img1-625.webp" alt="Tower" class="img-one">
ἔρως
ἔρως6mo ago
instead of max-width, it's min-width basically, yes first, the lower resolution image, and if the screen is bigger enough it loads the original image
Vandana
VandanaOP6mo ago
first equation seems correct . lower resolution of img till 2820 screen size,then for large screens more than that it has high resoultion img i.e1122px
ἔρως
ἔρως6mo ago
yup, that's it
Vandana
VandanaOP6mo ago
then why you wrote equation2
ἔρως
ἔρως6mo ago
what do you mean?
Vandana
VandanaOP6mo ago
you got confused here. this sentence is right ???
ἔρως
ἔρως6mo ago
yes, that is correct
Vandana
VandanaOP6mo ago
then first eq is right .. not the second one .
ἔρως
ἔρως6mo ago
no, because you want to show the full image only starting at 2820 pixels and under that, you want to show the 50% size image
Vandana
VandanaOP6mo ago
its anyway one and the same only it means
ἔρως
ἔρως6mo ago
no, the logic has to be swapped you have to change from max-width for the low-res, to min-width for the original
Vandana
VandanaOP6mo ago
whats the difference still i am not getting ,its anyhow same help me to understand this.
ἔρως
ἔρως6mo ago
the difference is that one will load the low-res image and the other loads the original
Vandana
VandanaOP6mo ago
ya bu then i am getting confused about max and min width media query .. <img srcset="/images/img1-625.webp 561w, /images/img1.webp 1122w" sizes="(max-width: 2820px) 561px, 1122px" src="/images/img1.webp" alt="Tower" class="img-one"> here also one will load low resolution image and the other the high resolution after 2820 screen size
ἔρως
ἔρως6mo ago
that might work as well, try it
Vandana
VandanaOP6mo ago
tehn before it was that only look here
ἔρως
ἔρως6mo ago
i didn't notice
Vandana
VandanaOP6mo ago
Ahhh!
ἔρως
ἔρως6mo ago
b?
Vandana
VandanaOP6mo ago
what?
ἔρως
ἔρως6mo ago
you said "ahhh", i said "b"
Vandana
VandanaOP6mo ago
meaning
ἔρως
ἔρως6mo ago
i don't know why you said it a = 1st letter of the alphabet
Vandana
VandanaOP6mo ago
it took lot of time to explain it to you i guess since sday
ἔρως
ἔρως6mo ago
yeah, because i wasn't noticing any differences
Vandana
VandanaOP6mo ago
all images being the same right
ἔρως
ἔρως6mo ago
no, you don't use code blocks makes everything look the same, and very hard to read
Vandana
VandanaOP6mo ago
nopes now ill start to use.
ἔρως
ἔρως6mo ago
thank you
Vandana
VandanaOP6mo ago
? is this becuase of the difficulty in reading the code
ἔρως
ἔρως6mo ago
no, it's because it's better for old browsers or browsers without srcset support, it loads the low quality image by default
Vandana
VandanaOP6mo ago
i hope this is correct
ἔρως
ἔρως6mo ago
it seems correct
Vandana
VandanaOP6mo ago
seems correct and correct there is a difference.
ἔρως
ἔρως6mo ago
yes, and the difference is that it isn't tested
Vandana
VandanaOP6mo ago
No description
Vandana
VandanaOP6mo ago
correct or seems correct?
ἔρως
ἔρως6mo ago
correct
Vandana
VandanaOP6mo ago
thanks a ton big relief
ἔρως
ἔρως6mo ago
you're welcome
Vandana
VandanaOP6mo ago
but then a doubt
ἔρως
ἔρως6mo ago
ask it
ἔρως
ἔρως6mo ago
by the way, 4 and 8 need a look
No description
ἔρως
ἔρως6mo ago
also, your 978kb website is just 356kb now
Vandana
VandanaOP6mo ago
good right?
ἔρως
ἔρως6mo ago
however, for mobile, it's loading the full size images
No description
Vandana
VandanaOP6mo ago
ἔρως
ἔρως6mo ago
i know
Vandana
VandanaOP6mo ago
but the link here is different.
ἔρως
ἔρως6mo ago
well, the link is wrong in your github then
ἔρως
ἔρως6mo ago
same issue anyways
No description
Vandana
VandanaOP6mo ago
for mobile?
ἔρως
ἔρως6mo ago
yes by the way, i just noticed you don't have lazy loading
Vandana
VandanaOP6mo ago
No description
Vandana
VandanaOP6mo ago
but then in currentSRC it shows the 50% image over here. One big issue .
ἔρως
ἔρως6mo ago
on desktop or mobile?
Vandana
VandanaOP6mo ago
everything is 100% resolution only webp image everything was working the day before only. both
ἔρως
ἔρως6mo ago
try what i said for an image
Vandana
VandanaOP6mo ago
min-width right?
ἔρως
ἔρως6mo ago
yes
Vandana
VandanaOP6mo ago
not working..
ἔρως
ἔρως6mo ago
what's the code?
Vandana
VandanaOP6mo ago
<img srcset="/images/img1-625.webp 561w, /images/img1.webp 1122w" sizes="(min-width: 2820px) 1122px, 561px" src="/images/img1-625.webp" alt="Tower" class="img-one">
ἔρως
ἔρως6mo ago
try adding a max-width to the 2nd size
Vandana
VandanaOP6mo ago
No description
ἔρως
ἔρως6mo ago
is it working?
Vandana
VandanaOP6mo ago
no its being so frustrating,because by the day it was working well
<img srcset="/images/img1-625.webp 561w, /images/img1.webp 1122w" sizes="(min-width: 2820px) 1122px,(max-width: 2819px) 561px" src="/images/img1-625.webp" alt="Tower" class="img-one">
<img srcset="/images/img1-625.webp 561w, /images/img1.webp 1122w" sizes="(min-width: 2820px) 1122px,(max-width: 2819px) 561px" src="/images/img1-625.webp" alt="Tower" class="img-one">
ἔρως
ἔρως6mo ago
that should have worked
Vandana
VandanaOP6mo ago
why did this broke suddenly? and even trying the same as the day before it isnt working.We had reached 90%,but now!!
ἔρως
ἔρως6mo ago
i have no idea images are absolute hell
Vandana
VandanaOP6mo ago
what can be done
ἔρως
ἔρως6mo ago
honestly, at this point, i would stick with just the low quality images the website looks the same, until you check it on a 4k display
Vandana
VandanaOP6mo ago
But then these many days of efforts will go in vain which i dont want too
ἔρως
ἔρως6mo ago
no, they won't i mean, a tinsy tinsy bit, but that's ok
Vandana
VandanaOP6mo ago
then now i need to remove srcset then
ἔρως
ἔρως6mo ago
yes, and sizes but keep the src set to the low resolution version and that last part is where 99% of the work was done
Vandana
VandanaOP6mo ago
what will happen by keeping ,we didnt achieve the desired result right. its disappointing me,Because with lots of patience you have taken up this and i am very grateful for your help and i dont wanna leave it like that only without achieving.
ἔρως
ἔρως6mo ago
we achieved 50% and that 50% is the most important half
Vandana
VandanaOP6mo ago
rest 50%??
ἔρως
ἔρως6mo ago
not as important it will only affect 4k users
Vandana
VandanaOP6mo ago
ohh! one more thing you stated about lazy loading i tried to use the attribute loading="lazy didnt achieve that as well
ἔρως
ἔρως6mo ago
loading="lazy" decoding="async" add those to all images and the website should load just the few images at the top
Vandana
VandanaOP6mo ago
Done with this but seems no change i felt as before only GIGANTIC doesnt happen all images loading at once only i checked the network tab
ἔρως
ἔρως6mo ago
show me
Vandana
VandanaOP6mo ago
No description
ἔρως
ἔρως6mo ago
and you've set the lazy loading on all images?
Vandana
VandanaOP6mo ago
yes yes
ἔρως
ἔρως6mo ago
can you update the page then?
Vandana
VandanaOP6mo ago
in the sense?
ἔρως
ἔρως6mo ago
it didn't load as many as before, just 10 images
No description
ἔρως
ἔρως6mo ago
the other 4 loaded later
No description
ἔρως
ἔρως6mo ago
i think i know the issue
Vandana
VandanaOP6mo ago
again?
ἔρως
ἔρως6mo ago
No description
Vandana
VandanaOP6mo ago
go ahead what is it?
ἔρως
ἔρως6mo ago
this is your website before loading the images
ἔρως
ἔρως6mo ago
and without css, this is it
No description
ἔρως
ἔρως6mo ago
so, all images are shown at some point, because you don't have any critical css/above-the-fold css
Vandana
VandanaOP6mo ago
critical css represents what? and what is above-the-fold-css
ἔρως
ἔρως6mo ago
it's everything that's visible when the website loads all the content that's at the top, before the scroll why is this important? well, when the website loads, it needs to download the css to show the page properly but until the css is loaded, the website will be all ugly the critical/above-the-fold css is used to apply just enough styles so that the layout isn't all broken stuff like colors and things like that will be missing, but the website will sorta kinda resemble what you have
Vandana
VandanaOP6mo ago
ohh then if we have that critical fold css then lazy loading might work?
ἔρως
ἔρως6mo ago
it should, yes
Vandana
VandanaOP6mo ago
then in my case critical fold-css is not required actually for what can i use since entire website is of images only
ἔρως
ἔρως6mo ago
lazy loading won't always work, but it's fine it's less than 400kb, so, it's fine
Vandana
VandanaOP6mo ago
okay then one another thing you told me to minify css but then i tried to research how to do it
ἔρως
ἔρως6mo ago
yes, you can do it manually with any of the many online tools
Vandana
VandanaOP6mo ago
CSS Minifier & Compressor | Toptal®
Use our CSS Minifier & Compressor tool to reduce CSS code size and make your website load faster. Get started for free now.
ἔρως
ἔρως6mo ago
or, you can configure your build script to do it all that one is ok
Vandana
VandanaOP6mo ago
how is this?
ἔρως
ἔρως6mo ago
that's something im terrible at i recommend asking about it in a different post
Vandana
VandanaOP6mo ago
but then a general question if i write the minified css ,how will the third person read my code?
ἔρως
ἔρως6mo ago
why are you worried about that?
Vandana
VandanaOP6mo ago
then the minified code is lines of code without spaces,forget third person i myself cant read that code
ἔρως
ἔρως6mo ago
that's why you only do it when you deploy the site
Vandana
VandanaOP6mo ago
okay Thanks for answering .
ἔρως
ἔρως6mo ago
you're welcome
Vandana
VandanaOP6mo ago
any other improvements fot this project?
ἔρως
ἔρως6mo ago
no, that's it
Vandana
VandanaOP6mo ago
i guess its been a long headace for you apologies.But i have learnt lot many things through this !Sincerly Thank you!!
ἔρως
ἔρως6mo ago
you're welcome
Vandana
VandanaOP6mo ago
https://discord.com/channels/436251713830125568/1253729651826757673 pls help me here as well i am stuck and no response might be that post isnt highlighted
ἔρως
ἔρως6mo ago
it's against the rules to do that also, you've got plenty of people answering to you there
Vandana
VandanaOP6mo ago
i understand, but then take a glance of it.may be it can save time for everyone
ἔρως
ἔρως6mo ago
i will check later
Vandana
VandanaOP6mo ago
sure thanks for the help and always responding.
ἔρως
ἔρως6mo ago
you're welcome
Vandana
VandanaOP6mo ago
Can you pls look into it.It would be a great help
Want results from more Discord servers?
Add your server