Search code examples
firefoxsvgtransparencyrendercoreldraw

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.


Solution

  • 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):

    1. 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.
    2. I removed height and width attributes from both SVGs.
    3. 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).
    4. I used SVG Optimiser tool to remove all the unnecessary bits from my images and to slim them down a little.
    5. I downloaded optimised SVGs from above mentioned tool's website, uploaded them to my website's FTP.
    6. I added height:(some)px and width:auto attributes in CSS
    7. 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.