Some website images not displaying properly on iPhone - html

I've developed a responsive website, and just when I thought it was perfect and ready to launch, I found out that the images on the homepage are not displaying properly on iPhones (I developed the site while testing on an Android, so I was none the wiser about iPhone oddities until now). The images should be fitting into the width of the screen (I've set max-width: 100%; on them), but instead they are stretched and pixelated way beyond their actual resolution.
Curiously, images on any other page of the site display just fine. I thought the issue was rooted in the fact that the images on the homepage are actually set via a CSS background property, while images everywhere else are set in <img> tags in the HTML. So I commented out the "background" declarations in the CSS file and instead used <img> tags on the homepage, just like everywhere else. When I did that to the very first image, it displayed great. However, as soon as I switched the rest of the images to HTML, they all reverted back to the ugly that was present before.
My boss (who has access to an iPhone) sent me this video (apologies for it being out of focus, but you get the idea): https://www.youtube.com/watch?v=_vFJVZiBc3Q
The first four images he scrolls past ought to all fit above the fold, and you're only seeing the left ~1/10th of the actual image, that's how far it's stretched out.
I'm out of ideas here. Is there anything special I need to do for iPhones? With the <img> tag, these photos should be in the same format that the rest of the working images are in.
Thanks so much in advance!

As it turns out, it was a me-specific issue. Apologies for being vague above, I really had no idea what I should have been looking for when it came to iPhones. The images in question were contained in <div>s in which I specified a height in vh units. As a future reference for anyone reading this, you apparently shouldn't do that. Changing height to a percent unit fixed the issue, and it displays great on both Android and iPhone!

Related

Why is an embedded SVG causing CLS (Cumulative Layout Shift) on Desktop but not on Mobile?

I'm working on a website that's using a lot of embedded SVGs instead of linking them through an <img> tag, since that speeds up loading times. Most of them are pretty simple, single-colored and don't shift. Since our logo was made as an SVG as well it's embedded into the page as HTML too.
One day Search Console started reporting a CLS issue on Desktop, but not on mobile. I tested it locally but I wasn't able to see any layout shift nor find a cause. I went ahead and tested the page with https://developers.google.com/speed/pagespeed/insights/ and https://layoutstability.rocks/ and both reported the same, a CLS on Desktop but not on mobile.
Screenshots of the tests can be found here:
CLS issue on Desktop
No CLS issue on Mobile
PageSpeed Insights reporting the causing element
As you can see above PageSpeed Insights marked the embedded logo SVG as the cause for the ongoing layout shifts.
Causing element identified
Above you can see how I identified the causing element.
So now I'm wondering not only about the issue with the SVG shifting around but also about the issue only happening on Desktop.
Is there an easy way to fix CLS issues with embedded SVGs? Or do I need to specify static height and width to preserve the space? I'd like to not do so since the SVG is scaling when resizing the browser width which would limit the responsiveness.
I also wasn't able to find any resources on that issue whatsoever, seems like I'm the first posting about it.
Any help appreciated! (as a reference, this is the affected page: https://hydra.bot)
I actually found the issue and it has nothing to do with the SVG but with the webfont swapping in. Removing the webfont from the font-family stack solves the issue. Not sure how to use webfonts without CLS then though.
The problem is that having images and not indicating a width and height they grow and then adjust according to your CSS, you must indicate the dimensions for the browser to reserve the space while the images are loading.
You can find more about this at: https://web.dev/optimize-cls/

Business Catalyst responsive gallery

I have done about 20 websites which included the Business Catalyst gallery module. This is the first one that I'm having problems with and I don't know why. Please check out: http://topspindenver.businesscatalyst.com/gallery.html.
You will notice that if you make the window smaller, the gallery thumbnails start overflowing the window. In every other website that I've done, the gallery was responsive within the specified skeleton columns, and the thumbnails automatically get smaller, like on this site: http://mountaingardendiva.com/.
Does anyone know why this is happening only on this site? I have already tried specifically targeting the table that the thumbnails sit in and given it a max-width:100%, but it didn't work.
I'm guessing you're using Firefox to view this site and noticing this problem for the first time, because it looks fine in Chrome. It has to do with how Firefox computes the width of a table and the max-width of images within the table. You can solve the problem by applying a max-width to td.photogalleryitem with each media query that changes the page width.
It does work in Chrome, but to make it work in FireFox try setting the css on your images to width:100% instead of max-width:100%

IE6 (the joys) quirks - sporadic issues

Apologies to inflict an IE6 post on everyone - posting in the hope that someone will have had experience of these issues. I don't have a link for now unfortunately, but the first issue is that occasionally images are stretched without keeping aspect ratio - the images have their height and width defined in the tag, then in the css file their width is set to be a little smaller than that. Sometimes the images load fine, sometimes really badly stretched. Any ideas what is happening here? Fine in all other browsers.
The other issue, which I've not come across before, is that some pages on my site need a refresh of the page for floated elements to align properly. Is there a reason why this could happen in IE6?
Thanks, and apologies again :)

High Resolution Image IE Browser Rendering

I am optimizing my site for these higher resolution monitors (especially the new iPad). I have the site formatted the way I want, and I was just increasing the resolution of each image but still constraining it to the DIVs that I currently have. For example, I have an image with a resolution of 483x246 and I have it fitting a DIV with a set size of 188x96.
The images look great on Chrome, Firefox, and most importantly on the new iPad. Even zoomed in it's nice and crisp (as opposed to my old 188x96 image that looked blurry and pixelated when zoomed in)
The problem comes in when I open the page in IE. It displays the image at the correct size but it's jagged. See link to comparison below. I know it's an issue with the way IE resizes and renders pictures on the fly.
My question would be, is there a way to make IE display the picture nicely? If not, is there a way I can put in the code so that if it detects IE, it displays my old low res image? I've looked everywhere but haven't found anything that relates to my specific problem. I know this is a small example but my bigger images do the same thing and are more noticeable. I hope you all can help. Thanks. :)
Comparison:
Have you tried putting this in your CSS?
img { -ms-interpolation-mode: bicubic; }
There's also this https://github.com/adamdbradley/foresight.js which looks very interesting
Make sure IE9 isn't in compatibility mode or IE7/8 mode...
The reason this happends if because the bitmapdata is actually rendered completely different in the IE browser, the thing IE does is it "cuts" away pixels over a set ratio so like every 5 pixels it yanks a pixel and therefor makes it look like it misses certain gradient properties.
not much you can do about this except for keeping the aspect ratio set but I guess you would've known that by yourself already

choppy scrolling in IE7

I've built a website for someone, but according to him, scrolling is very very choppy on the website in IE7 on his computer. On my computer I don't have any problems with scrolling (in any browser), i've already tried some things, but according to him scrolling still is very choppy. So I was wondering if someone has some suggestions for me? I think the main problem is the full width background image, but i'm not entirely sure.
The website is:
www.casalagodilugano.nl
The website is in dutch, but for this question that doesn't have to matter
edit:
Tx for the helpful answers. In the end, it was indeed the background image which caused problems in IE7. By accident I found a way to work around this problem: I set the image as the background image, centered the image, and using css3 I made sure the was stretched the way it should.
I had a problem similar to this. It turned out to be because my computer was full and my performance suffered. Viewing the issue on my new machine (also had IE7) produced no choppy scrolling. I fear your client has the same problem, perhaps suggest it's his computer and not your website?
Edit:
Many things affect the processing on a website, I'd suggest it has to do with your background image. The sand has quite a "repeatable" texture so perhaps you should Photoshop it down so it's a much smaller image and just use 'background-repeat' in your CSS to achieve a similar effect. Your background image is also around 200% of what it displays on the website, I copied the URL of the image and viewed it by itself and it's HUGE! The emphasis here is on image file size, because IE is having trouble shifting the image down when you scroll. It's not a very good browser to be fair. I've also noticed that your large header image is larger in actual size, suggesting that the size is reduced by your code. Try reducing this image size to the size you want to display it
Edit pt 2
I've stumbled upon a script that for some reason waits 5 seconds before running and that is the Google maps API. I respect that you need this for the Routes page but if I were you, on any page where there is no map, remove any mention of the google maps api from the source code.
I have found that IE gets choppy when you have an <input> tag without a border or background specified ... very strange IE "bug" but i've fixed choppy scrolling on sites/pages by just adding a border to the <input> tags.