Website looks wrong in Google Chrome - image

I have this website: hrrubin.dk
In chrome, you will notice that all images that have image switch on mouseover, are positioned wrong. This has flaw happened only recently. Maybe a cause of some changes to the chrome code.
Is the solution to make a chrome hack, so not to disturb the the rest of the browsers?

I think there's a better way to do it. You put all of those images in a sprite, and apply them as a background image to the a tag. Give distinct IDs to each a tag. Then use background positions to position them and to change them on hover. That's how its generally done.

Related

Why is Firefox displaying svg images wrong?

I encountered a weird Firefox's behaviour. It renders SVG images cutting parts of them or not displaying them at all, but only certain of images, not all of them. Chrome and IE are displaying them properly. Here is a link to the website I put said images on:
funjo.pl
Images which are not being displayed properly are logo in top menu bar and big blue logo with transparency on the big very top banner. The funny thing is that two icons a bit down on the same page (three rolls and woman's legs), which are also SVGs are being displayed properly. Could someone please tell me what's going on? I suppose there is something wrong with SVG image code itself but I can't detect what exactly.
I'm not pasting whole images' code beacuse it's too much of it. You can download these images from http://funjo.pl/media/2016/06/logo.svg and http://funjo.pl/media/2016/06/logo2.svg.
PS: If you really want me very badly to paste the whole code let me know.
PS2: I created all of SVGs on the website using Corel X7, if this information helps in anything.
PS3: I'm using the newest FF v 46.0.1.
Actually I've found a solution myself, it helped perfectly but required few more steps after exporting SVG in Corel X7 (as I mentioned in my post above there were two images, one of them with transparency). So here are the steps I made to make it being displayed properly in FF (a bit trial and error procedure but works):
I exported both SVGs again removing transparency from the one which was originally transparent, so no transparency at all in both SVG images. The one used as logo in menu bar contained all the elements grouped (logo and text were both separate but grouped), I ungrouped those elements and made them as one.
I removed height and width attributes from both SVGs.
I added preserveAspectRatio="none" attribute so I could manage width and height of the image separately, just like raster images (this CSS Tricks article helps a lot with understanting the whole resizing process).
I used SVG Optimiser tool to remove all the unnecessary bits from my images and to slim them down a little.
I downloaded optimised SVGs from above mentioned tool's website, uploaded them to my website's FTP.
I added height:(some)px and width:auto attributes in CSS
I added transparency for the one which was supposed to be transparent via CSS - opacity:0.7 in this case.
Refreshed the website and voilĂ , it works like a charm. Hope it will help someone with the similar problem as mine.
EDIT
Here are images to compare, working one and not working one.
PS: After some more trials and errors I found out that changing standard text to curves in Corel X7 makes FF render the SVG image properly without above steps, but it doesn't change the fact that it worked properly in Chrome and IE anyway even if the text wasn't changed to curves before export. Plus FF didn't display SVG exported with transparency at all and Chrome and IE did.
You could open a working and failing SVG file into your text editor and find differences in the generated HTML.
I guess there is a difference the way you save it or how the vectors and layers are put. Maybe some transparent layer on top off the image renders strange?
Applying a width of 300px or above gave me the correct results as in chrome and IE.
So just give a width as below and probably you can adjust the width as per your requirement.
Hope it helps.
<img style="width: 300px;" src="http://funjo.pl/media/2016/06/logo.svg" alt="Funjo">
I solved it by removing commas , by spaces

Firefox canvas not showing anything after removed and added

I have a problem with the <canvas> in Firefox. Second time I remove and add it with Javascript, nothing will be drawn. I've checked the code and it seems find, it's even working in Chromium and Opera without any problems. Does anyone recognize this? I don't know how to debug the canvas.
I wish I could provide a code snippet, but I haven't been able to reproduce the bug outside it's code base.
Canvas is passive to changes that may affect the content. It doesn't keep track of these things.
The solution is to always update the content when a change occur such as in this case.
You can also tap into window.resize (Chrome for example may clear the canvas if you use the dialogs etc.) and there can be other unknown factors. So never assume canvas will contain what is drawn but always redraw everything in those cases.

Chrome resizes svg images

I have an img menu with svg images that changes the svg image with a identical image with a different color when you push in menu. When I test it with Chrome it works fine until you visit one link the second time, that chrome resize it to a smaller image.
I've made a lot of tests... I've tested :visited css, user agent css, and many another properties and it seems to be all ok. When you changes some css property in developer tools it changes automagically to correct size.
My last test was to change the width from 135px to 134px (don't ask why) and it works in 1680x1050 screen but not in 1920x1200 screen (???????). Is it an aspect ratio problem?
I'm getting crazy!!
I'm using angularjs to make the black image to red image change, but I think this is not the problem (it does a src replacement)
You can see it in the webpage http://silviaperezcruz.com.
I'll apreciate any kind of help.
PD: Sorry for my bad english
I couldn't see an obvious reason why it is doing it,. But if I had to guess, I would cast a suspicious eye on respond.js first. Does it still do it if you remove that?

z-index not working with images

I am trying to make it so these images will line up the way so that the blank.gif will appear in front of the image. i cannot use it as a background image, and i have tried using a negative z-index like -1 but then the image disappears all together on the site i have tried to use it on. my goal is to make the gray and black image appears behind the blank.gif.
things that i have to avoid or will not work are these:
z-index:-1 (just the negative numbers)
use of background image inside of a <div>
and both the images must remain inside a parent element, and my issue is that i cant use any script that needs to be inside of the head of the html. i have tried but cant find a solution. if you have any method of keeping an image from being right clicked and saved so easily then that would be great. any help is appreciated thank you.
image html are here: index.html
code sample:
<html><div style="position:absolute;width:150px;height:150px;display:inline;">
<img src="http://dl.dropbox.com/u/14413762/blank.gif" style="position:static:width:150px;height:150px;left:0px;top:0px;z-index:2;"><img src="http://dl.dropbox.com/u/14413762/bbc/image.png" style="position:absolute;left:0px;top:0px;;z-index:1;">
</div></html>
Yeah.. You're pretty much wasting time that is better spent elsewhere. A person who wants the image is going to get it, either with the web developer tools in firefox or chrome, viewing the page source, etc.
On a real note though, z-index only works with absolute, relative, or fixed positioned elements. It will not work with your statically positioned element that you set to a z-index of 2. I have done what you are trying to acheive with relatively positioned elements, z-index, and either top and left or negative top and left margins.

How to detect if SVG animation is available

Is there a good way to detect if SVG animation is available, and then adjust the DOM appropriately?
I'm using animateMotion to animate the motion of a g containing images. This only works in Mozilla; even worse, having the animateMotion unstarted leaves the images in a different position in both Mozilla and WebKit (but not the same place in each!).
It seems I need a way to adjust the properties on the g and images to deal with each scenario, and to add the animateMotion tag only if it would work. Any suggestions?
Modernizr detects only high level feature existence and trusts the browser not to lie. Desktop Safari, for example, has a big "Yes" for SMIL from Modernizr. But SMIL is only partly implemented in pretty much every browser (even Firefox 4!), and you have to test each individual attribute animation to figure out exactly which one is working or not.
For example, you can't animate the startOffset for text on a path animation in Desktop Safari using SMIL. There is no library that detects feature existence for things like this.
IMHO, where they exist you should use CSS transforms/animations for general purpose animation on everything other than IE. For IE, use Javascript (or Canvas) animations.
(BTW, animateTransform on Chrome is broken - it miscalculates the translations)
I just had this issue with a Samsung phone running Android 4.2.2. It would report true for all three of these: Modernizr.svg, Modernizr.svgclippaths, Modernizr.smil but no animation and the clip-paths where messed up. It looked like only one element could have a clip-path. Anyway, we ended with this not-so-great resolution:
isAndroid = /Android/.test( navigator.userAgent );
Sorry, android users, you'll only see the backup image. This is a horrible fix but it was only for a simple logo animation so...
Modernizr detects support for SVG animation (SMIL).
Without the complete example it's impossible to say for sure what's causing the differences.

Resources