CSS SVG align vertical middle with Label - css

Hi I have the following code where I need to vertical align the SVG with the label.
g {
fill: blue;
fill-rule: evenodd;
}
#firstdiv:hover {
border-radius: 25px;
background: #dcd9d9;
padding-top: 6px;
height: 35px;
width: 100%;
display: inline-block;
}
#svgcontainer {
display: inline;
}
<div id='firstdiv'>
<div id='svgcontainer'>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="22" height="22" viewBox="0 0 22 22">
<defs>
<path id="a" d="M11 11a3.666 3.666 0 0 0 3.667-3.667A3.666 3.666 0 0 0 11 3.667a3.666 3.666 0 0 0-3.667 3.666A3.666 3.666 0 0 0 11 11zm0 1.833c-2.447 0-7.333 1.229-7.333 3.667v1.833h14.666V16.5c0-2.438-4.885-3.667-7.333-3.667z"/>
</defs>
<g fill="none" fill-rule="evenodd">
<mask id="b" fill="#fff">
<use xlink:href="#a"/>
</mask>
<g fill="#000" fill-opacity=".54" mask="url(#b)">
<path d="M0 0h22v22H0z"/>
</g>
</g>
</svg>
</div>
Test
</div>
And when you hover nothing has to moved because right now when hover because the SVG is not vertically aligned to the middle when hover there is a move of the elements.
https://jsfiddle.net/164seo3g/1/
Thanks

Few pointers,
usually hover should change only the relevant css properties, it should not change layout & stuff, so, what I did is to split styles, without hover contains all the props that related to layout, hover, contains only the change.
You can use vertical-align: middle on item that has siblings, your svg was inside a container, and therefore this wasn't worked.
g {
fill: blue;
fill-rule: evenodd;
}
#firstdiv {
border-radius: 25px;
line-height: 35px;
width: 100%;
display: inline-block;
}
#firstdiv:hover {
background: #dcd9d9;
}
#svgcontainer {
display: inline-block;
vertical-align: middle;
}
<div id='firstdiv'>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="22" height="22" viewBox="0 0 22 22" id='svgcontainer'>
<defs>
<path id="a" d="M11 11a3.666 3.666 0 0 0 3.667-3.667A3.666 3.666 0 0 0 11 3.667a3.666 3.666 0 0 0-3.667 3.666A3.666 3.666 0 0 0 11 11zm0 1.833c-2.447 0-7.333 1.229-7.333 3.667v1.833h14.666V16.5c0-2.438-4.885-3.667-7.333-3.667z"/>
</defs>
<g fill="none" fill-rule="evenodd">
<mask id="b" fill="#fff">
<use xlink:href="#a"/>
</mask>
<g fill="#000" fill-opacity=".54" mask="url(#b)">
<path d="M0 0h22v22H0z"/>
</g>
</g>
</svg> Test
</div>

Related

Change the color of a SVG icon similar to grayscale but to shades of blue with CSS

I have a list of SVG icons that has colors in them which I use to display like below
I want to be able to re-use these SVG elsewhere in my webapp but change the color of the icons so that instead of showing color it only shows a certain shade of color. (Blue)
Is there a way to change this to blue similar to grayscale via CSS? (I'd rather not upload a separate SVG to do this)
The closest I got was something from following this How change hue of image with different colors with css filter to hue of blue
But I don’t want the square background right behind the icon. (I just want the SVG to change color)
.background {
padding: 16px;
background: rgb(199, 229, 242);
}
.donut {
width: 32px;
height: 32px;
position: relative;
}
.donut::before, .donut::after {
content: '';
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
}
.donut::before {
background-color: gray;
mix-blend-mode: color;
}
.donut::after {
mix-blend-mode: overlay;
background-color: blue;
}
<div class="background">
<div class="donut">
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<path d="M23.778 4.36A14 14 0 0016 2v5a9 9 0 11-9 9H2A14 14 0 1023.778 4.36z" fill="#E1BD16"/>
<path d="M6.1 6.1A14 14 0 002 16h5a9 9 0 019-9V2a14 14 0 00-9.9 4.1z" fill="#F85F4E"/>
</svg>
</div>
</div>
You could also apply a css filter directly on your donut icon like so:
filter: hue-rotate(180deg) saturate(75%);
Simple color shift example
.background {
padding: 16px;
background: rgb(199, 229, 242);
}
.icon-use {
width: 32px;
height: 32px;
display: inline-block;
}
.filter-blue-hover:hover,
.filter-blue {
filter: hue-rotate(180deg) saturate(75%);
}
<svg class="donut" style="display:none" fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<symbol id="icon">
<path d="M23.778 4.36A14 14 0 0016 2v5a9 9 0 11-9 9H2A14 14 0 1023.778 4.36z" fill="#E1BD16" />
<path d="M6.1 6.1A14 14 0 002 16h5a9 9 0 019-9V2a14 14 0 00-9.9 4.1z" fill="#F85F4E" />
</symbol>
</svg>
<div class="background">
<svg viewBox="0 0 32 32" class="icon-use filter-blue">
<use href="#icon" />
</svg>
</div>
<p>
<svg viewBox="0 0 32 32" class="icon-use filter-blue-hover">
<use href="#icon" />
</svg> Filter on hover - no background color needed.
</p>
Edit: normalized colorizing
This example avoids undesired colors caused by relative hue shifts.
We first tint everything to a sepia tone by sepia(100%).
By this normalizing step, we can make sure all filtered colors will be in the desired hue range ("blueish" in this case).
//toggleFilter
function toggleFilter() {
let filterItems = document.querySelectorAll(".toggleFilter");
filterItems.forEach(function(el, i) {
el.classList.toggle("filter-blue");
});
}
.icon-use {
width: 1em;
height: 1em;
display: inline-block;
font-size: 10vw;
transition: 0.3s;
}
.filter-blue {
transition: 0.3s filter ease-in-out;
filter: invert(0%) sepia(100%) saturate(300%) hue-rotate(-180deg);
}
.filter-blue:hover {
filter: invert(0%) sepia(0%) saturate(100%) hue-rotate(0deg);
}
.icon-wrp {
position: relative;
display: inline-block;
width: 1em;
font-size: 10vw;
}
<p>
<button id="btnFilter" onclick="toggleFilter()">Toggle Filter</button>
</p>
<svg class="donut" style="display:none" fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<symbol id="slice">
<circle cx="50%" cy="50%" r="25%" fill="none" pathLength="99" />
</symbol>
</svg>
<div class="icon-wrp">
<!-- pie chart-->
<svg viewBox="0 0 32 32" class="toggleFilter">
<use href="#slice" stroke="#E1BD16" stroke-width="16" />
<use href="#slice" stroke="#F85F4E" stroke-width="16" stroke-dasharray="33 100" />
<use href="#slice" stroke="purple" stroke-width="16" stroke-dashoffset="-33" stroke-dasharray="33 100" />
</svg>
</div>
<div class="icon-wrp">
<!-- pie chart-->
<svg viewBox="0 0 32 32" class="toggleFilter " transform="scale(1.5)">
<use href="#slice" stroke="blue" stroke-width="4" />
<use href="#slice" stroke="green" stroke-width="4" stroke-dasharray="33 100" />
<use href="#slice" stroke="orange" stroke-width="4" stroke-dashoffset="-33" stroke-dasharray="33 100" />
</svg>
</div>
<div class="icon-wrp">
<!-- pie chart-->
<svg viewBox="0 0 32 32" class="toggleFilter ">
<use href="#slice" stroke="yellow" stroke-width="16" />
<use href="#slice" stroke="cyan" stroke-width="16" stroke-dasharray="33 100" />
<use href="#slice" stroke="magenta" stroke-width="16" stroke-dashoffset="-33" stroke-dasharray="33 100" />
</svg>
</div>
This approach is based on the popular svg coloring concept described here (How to change the color of an svg element?).
The main benefit:
you don't need additional (background) elements to control the mix-blendmode color calculations.
Drawbacks:
you will have to tweak the different hue-shift properties to get the desired color result.
I found that you can add a position absolute SVG with a fill of the color that you want. Then using mix-blend-mode: overlay; and filter: grayscale(1); you can get the shade of color that you want
.background {
padding: 16px;
background: rgb(199, 229, 242);
}
.donut {
width: 32px;
height: 32px;
filter: grayscale(1);
mix-blend-mode: overlay;
z-index: 1;
}
.donut-background {
width: 32px;
height: 32px;
position: absolute;
z-index: 0;
}
.donut-background * {
fill: #2C93BF;
}
<div class="background">
<svg class="donut-background" fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<path d="M23.778 4.36A14 14 0 0016 2v5a9 9 0 11-9 9H2A14 14 0 1023.778 4.36z" fill="#E1BD16"/>
<path d="M6.1 6.1A14 14 0 002 16h5a9 9 0 019-9V2a14 14 0 00-9.9 4.1z" fill="#F85F4E"/>
</svg>
<svg class="donut" fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<path d="M23.778 4.36A14 14 0 0016 2v5a9 9 0 11-9 9H2A14 14 0 1023.778 4.36z" fill="#E1BD16"/>
<path d="M6.1 6.1A14 14 0 002 16h5a9 9 0 019-9V2a14 14 0 00-9.9 4.1z" fill="#F85F4E"/>
</svg>
</div>
Using filter with just the SVG's paths not the background to change color based on the original colors:
.background {
margin: 1rem;
}
.donut {
height: 32px;
width: 32px;
}
.donut svg:hover {
filter: hue-rotate(180deg);
}
<div class="background">
<div class="donut">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<path d="M23.778 4.36A14 14 0 0016 2v5a9 9 0 11-9 9H2A14 14 0 1023.778 4.36z" fill="#E1BD16"/>
<path d="M6.1 6.1A14 14 0 002 16h5a9 9 0 019-9V2a14 14 0 00-9.9 4.1z" fill="#F85F4E"/>
</svg>
</div><br>
Hover over image.
</div>

How to center an SVG graphic in its container div

I am designing a custom Sign in with Google button.
It looks like the following:
As you can see, the Google logo with the white background is not vertically centered.
How can I vertically center it in the blue container box?
I want the final result to look like the following:
The code snippets are as follows:
login.svg (Located in the public folder)
<svg width="46px" height="46px" viewBox="0 0 46 46" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
<!-- Generator: Sketch 3.3.3 (12081) - http://www.bohemiancoding.com/sketch -->
<title>btn_google_dark_normal_ios</title>
<desc>Created with Sketch.</desc>
<defs>
<filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-1">
<feOffset dx="0" dy="1" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset>
<feGaussianBlur stdDeviation="0.5" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.168 0" in="shadowBlurOuter1" type="matrix" result="shadowMatrixOuter1"></feColorMatrix>
<feOffset dx="0" dy="0" in="SourceAlpha" result="shadowOffsetOuter2"></feOffset>
<feGaussianBlur stdDeviation="0.5" in="shadowOffsetOuter2" result="shadowBlurOuter2"></feGaussianBlur>
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.084 0" in="shadowBlurOuter2" type="matrix" result="shadowMatrixOuter2"></feColorMatrix>
<feMerge>
<feMergeNode in="shadowMatrixOuter1"></feMergeNode>
<feMergeNode in="shadowMatrixOuter2"></feMergeNode>
<feMergeNode in="SourceGraphic"></feMergeNode>
</feMerge>
</filter>
<rect id="path-2" x="0" y="0" width="40" height="40" rx="2"></rect>
<rect id="path-3" x="5" y="5" width="38" height="38" rx="1"></rect>
</defs>
<g id="Google-Button" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
<g id="9-PATCH" sketch:type="MSArtboardGroup" transform="translate(-608.000000, -219.000000)"></g>
<g id="btn_google_dark_normal" sketch:type="MSArtboardGroup" transform="translate(-1.000000, -1.000000)">
<g id="button" sketch:type="MSLayerGroup" transform="translate(4.000000, 4.000000)" filter="url(#filter-1)">
</g>
<g id="button-bg-copy">
<use fill="#FFFFFF" fill-rule="evenodd" sketch:type="MSShapeGroup" xlink:href="#path-3"></use>
<use fill="none" xlink:href="#path-3"></use>
<use fill="none" xlink:href="#path-3"></use>
<use fill="none" xlink:href="#path-3"></use>
</g>
<g id="logo_googleg_48dp" sketch:type="MSLayerGroup" transform="translate(15.000000, 15.000000)">
<path d="M17.64,9.20454545 C17.64,8.56636364 17.5827273,7.95272727 17.4763636,7.36363636 L9,7.36363636 L9,10.845 L13.8436364,10.845 C13.635,11.97 13.0009091,12.9231818 12.0477273,13.5613636 L12.0477273,15.8195455 L14.9563636,15.8195455 C16.6581818,14.2527273 17.64,11.9454545 17.64,9.20454545 L17.64,9.20454545 Z" id="Shape" fill="#4285F4" sketch:type="MSShapeGroup"></path>
<path d="M9,18 C11.43,18 13.4672727,17.1940909 14.9563636,15.8195455 L12.0477273,13.5613636 C11.2418182,14.1013636 10.2109091,14.4204545 9,14.4204545 C6.65590909,14.4204545 4.67181818,12.8372727 3.96409091,10.71 L0.957272727,10.71 L0.957272727,13.0418182 C2.43818182,15.9831818 5.48181818,18 9,18 L9,18 Z" id="Shape" fill="#34A853" sketch:type="MSShapeGroup"></path>
<path d="M3.96409091,10.71 C3.78409091,10.17 3.68181818,9.59318182 3.68181818,9 C3.68181818,8.40681818 3.78409091,7.83 3.96409091,7.29 L3.96409091,4.95818182 L0.957272727,4.95818182 C0.347727273,6.17318182 0,7.54772727 0,9 C0,10.4522727 0.347727273,11.8268182 0.957272727,13.0418182 L3.96409091,10.71 L3.96409091,10.71 Z" id="Shape" fill="#FBBC05" sketch:type="MSShapeGroup"></path>
<path d="M9,3.57954545 C10.3213636,3.57954545 11.5077273,4.03363636 12.4404545,4.92545455 L15.0218182,2.34409091 C13.4631818,0.891818182 11.4259091,0 9,0 C5.48181818,0 2.43818182,2.01681818 0.957272727,4.95818182 L3.96409091,7.29 C4.67181818,5.16272727 6.65590909,3.57954545 9,3.57954545 L9,3.57954545 Z" id="Shape" fill="#EA4335" sketch:type="MSShapeGroup"></path>
<path d="M0,0 L18,0 L18,18 L0,18 L0,0 Z" id="Shape" sketch:type="MSShapeGroup"></path>
</g>
<g id="handles_square" sketch:type="MSLayerGroup"></g>
</g>
</g>
</svg>
App.js
import React from "react";
const App = () => {
return (
<div className="customBtn">
<img src="login.svg" />
<div className="buttonText">Sign in with Google</div>
</div>
);
};
export default App;
index.css
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 10px;
}
.customBtn {
margin: 10rem;
width: 19rem;
height: auto;
background-color: #4285f4;
border-radius: 0.2rem;
position: relative;
}
.buttonText {
font-size: 1.4rem;
font-weight: bold;
font-family: "Roboto", sans-serif;
color: white;
position: absolute;
top: 50%;
left: 30%;
transform: translateY(-50%);
}
Try this with flex.
Add to .customBtn class this styles:
.customBtn {
...your style
display: flex;
justify-content: center;
align-items: center;
}
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 10px;
}
.customBtn {
background-color: #4285f4;
border-radius: 0.2rem;
overflow: hidden;
border: none;
display: flex;
align-items: center;
}
.buttonText {
font-size: 1.4rem;
font-weight: bold;
font-family: "Roboto", sans-serif;
color: white;
padding: 1em;
}
<button class="customBtn">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="46" height="46"><defs><filter id="a" width="200%" height="200%" x="-50%" y="-50%" filterUnits="objectBoundingBox"><feOffset dy="1" in="SourceAlpha" result="shadowOffsetOuter1"/><feGaussianBlur in="shadowOffsetOuter1" result="shadowBlurOuter1" stdDeviation=".5"/><feColorMatrix in="shadowBlurOuter1" result="shadowMatrixOuter1" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.168 0"/><feOffset in="SourceAlpha" result="shadowOffsetOuter2"/><feGaussianBlur in="shadowOffsetOuter2" result="shadowBlurOuter2" stdDeviation=".5"/><feColorMatrix in="shadowBlurOuter2" result="shadowMatrixOuter2" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.084 0"/><feMerge><feMergeNode in="shadowMatrixOuter1"/><feMergeNode in="shadowMatrixOuter2"/><feMergeNode in="SourceGraphic"/></feMerge></filter><rect id="b" width="38" height="38" x="5" y="5" rx="1"/></defs><g fill="none" fill-rule="evenodd"><g filter="url(#a)" transform="translate(3 3)"/><g transform="translate(-1 -1)"><use xlink:href="#b" fill="#FFF"/><use xlink:href="#b"/><use xlink:href="#b"/><use xlink:href="#b"/></g><path fill="#4285F4" d="M31.64 23.205c0-.639-.057-1.252-.164-1.841H23v3.481h4.844a4.14 4.14 0 0 1-1.796 2.716v2.259h2.908c1.702-1.567 2.684-3.875 2.684-6.615Z"/><path fill="#34A853" d="M23 32c2.43 0 4.467-.806 5.956-2.18l-2.908-2.259c-.806.54-1.837.86-3.048.86-2.344 0-4.328-1.584-5.036-3.711h-3.007v2.332A8.997 8.997 0 0 0 23 32Z"/><path fill="#FBBC05" d="M17.964 24.71a5.41 5.41 0 0 1-.282-1.71c0-.593.102-1.17.282-1.71v-2.332h-3.007A8.996 8.996 0 0 0 14 23c0 1.452.348 2.827.957 4.042l3.007-2.332Z"/><path fill="#EA4335" d="M23 17.58c1.321 0 2.508.454 3.44 1.345l2.582-2.58C27.463 14.891 25.426 14 23 14a8.997 8.997 0 0 0-8.043 4.958l3.007 2.332c.708-2.127 2.692-3.71 5.036-3.71Z"/><path d="M14 14h18v18H14V14Z"/></g></svg>
<div class="buttonText">Sign in with Google</div>
</button>
All it took for me was adding "line-height: 0;" to your .customBtn style definition.

Styling the stroke of an SVG in CSS's pseudo attribute 'content: url()'

I have a SVG which I imported via
.nav-arrow::after {
content: url(data:image/svg+xml;base64,xevr...);
}
Now I want to define the color of the stroke via CSS, which doesn't work.
Do you have an idea how to import the SVG without any HTML and still being able to style it?
that's my SVG:
<svg class="nav-arrow" height="40" width="40">
<g fill="#fff">
<path stroke="#a01b1b" stroke-width="2" d="M 0 5 L 20 20 L 0 35" />
</g>
</svg>
In this particular case you can use the SVG as mask and adjust the background color:
.box {
display:inline-block;
width:40px;
height:60px;
position:relative;
}
.box::before,
.box::after{
content:"";
position:absolute;
top:0;
left:0;
right:0;
bottom:0;
}
/* The stroke */
.box::after {
background:var(--c,red);
-webkit-mask:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="5 0 10 40" height="40" width="40"><path fill="transparent" stroke="black" stroke-width="2" d="M 0 5 L 20 20 L 0 35" /></svg>') center/contain no-repeat;
mask:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="5 0 10 40" height="40" width="40"><path fill="transparent" stroke="black" stroke-width="2" d="M 0 5 L 20 20 L 0 35" /></svg>') center/contain no-repeat;
}
/* The fill */
.box::before {
background:#f1f1f1;
-webkit-mask:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="5 0 10 40" height="40" width="40"><path d="M 0 5 L 20 20 L 0 35" /></svg>') center/contain no-repeat;
mask:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="5 0 10 40" height="40" width="40"><path d="M 0 5 L 20 20 L 0 35" /></svg>') center/contain no-repeat;
}
<div class="box"></div>
<div class="box" style="--c:blue;"></div>
<div class="box" style="--c:green;"></div>

SVG sprite on stack don't appear on Safarii

I created SVG sprite, where icons are on stack and displayed when targeting chosen ID. It works ok, but I don't know why, icons not appear on Safari, I can't find explanation in case when you're using SVG as a background. Is any one familiar with this problem?
SVG
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="icon" class="icon" version="1.1">
<defs>
<style>
svg .icon {
display: none;
}
svg .icon:target {
display: inline-block;
}
</style>
</defs>
<svg viewBox="0 0 24 24">
<g id="icon-instagram" class="icon" fill="#fff">
<path fill-rule="nonzero"
d="M17.2808471,0 L6.58644706,0 C2.95468235,0 0,2.95482353 0,6.58658824 L0,17.2809882 C0,20.9128941 2.95468235,23.8675765 6.58644706,23.8675765 L17.2808471,23.8675765 C20.9128941,23.8675765 23.8675765,20.9127529 23.8675765,17.2809882 L23.8675765,6.58658824 C23.8677176,2.95482353 20.9128941,0 17.2808471,0 Z M21.7500706,17.2809882 C21.7500706,19.7452235 19.7452235,21.7499294 17.2809882,21.7499294 L6.58644706,21.7499294 C4.12235294,21.7500706 2.11764706,19.7452235 2.11764706,17.2809882 L2.11764706,6.58658824 C2.11764706,4.12249412 4.12235294,2.11764706 6.58644706,2.11764706 L17.2808471,2.11764706 C19.7450824,2.11764706 21.7499294,4.12249412 21.7499294,6.58658824 L21.7499294,17.2809882 L21.7500706,17.2809882 Z"/>
<path fill-rule="nonzero"
d="M11.9337882 5.784C8.54258824 5.784 5.78371765 8.54287059 5.78371765 11.9340706 5.78371765 15.3251294 8.54258824 18.0838588 11.9337882 18.0838588 15.3249882 18.0838588 18.0838588 15.3251294 18.0838588 11.9340706 18.0838588 8.54287059 15.3249882 5.784 11.9337882 5.784zM11.9337882 15.9660706C9.7104 15.9660706 7.90136471 14.1573176 7.90136471 11.9339294 7.90136471 9.7104 9.71025882 7.90150588 11.9337882 7.90150588 14.1573176 7.90150588 15.9662118 9.7104 15.9662118 11.9339294 15.9662118 14.1573176 14.1571765 15.9660706 11.9337882 15.9660706zM18.3417882 3.98837647C17.9337882 3.98837647 17.5329882 4.15355294 17.2448471 4.44296471 16.9552941 4.73096471 16.7888471 5.13190588 16.7888471 5.54131765 16.7888471 5.94945882 16.9554353 6.35025882 17.2448471 6.63967059 17.5328471 6.92767059 17.9337882 7.09425882 18.3417882 7.09425882 18.7512 7.09425882 19.1507294 6.92767059 19.4401412 6.63967059 19.7295529 6.35025882 19.8947294 5.94931765 19.8947294 5.54131765 19.8947294 5.13190588 19.7295529 4.73096471 19.4401412 4.44296471 19.1521412 4.15355294 18.7512 3.98837647 18.3417882 3.98837647z"/>
</g>
</svg>
<svg viewBox="0 0 24 24">
<g id="icon-facebook" class="icon" fill="#fff">
<path d="M2.93630055,4.93539414 L2.93630055,8.17223941 L0.564884222,8.17223941 L0.564884222,12.1302664 L2.93630055,12.1302664 L2.93630055,23.8921306 L7.80769311,23.8921306 L7.80769311,12.1305943 L11.0766237,12.1305943 C11.0766237,12.1305943 11.3827734,10.2327507 11.5311748,8.15764524 L7.82611347,8.15764524 L7.82611347,5.45138285 C7.82611347,5.04690017 8.35724295,4.50281631 8.88219587,4.50281631 L11.5363128,4.50281631 L11.5363128,0.382285714 L7.92761676,0.382285714 C2.81588497,0.382012415 2.93630055,4.34397487 2.93630055,4.93539414 Z"/>
</g>
</svg>
CSS
.icon-instagram {
width: 24px;
height: 24px;
background: url("../svg/viva-sprite.svg#icon-instagram") no-repeat;
}
.icon-facebook {
width: 24px;
height: 24px;
background: url("../svg/viva-sprite.svg#icon-facebook") no-repeat;
}

SVG mix-blend-mode not showing in firefox

Testing an svg using mix-blend-mode: multiply in Firefox 44 and it will not apply the blend-mode at all. But on another page I have a similar SVG and it shows fine. So it seems like the problem is with the SVG code itself...
I've seen a few other people having similar issues and have looked at all the proposed solutions, none of which worked for me. (adding background-color to div, adding a transparent border)
HTML:
<div class="about-background clearfix">
<object class="willItBlend" data="../svg/about-bg.svg" type="image/svg+xml"></object>
<img class="blender" src="../svg/about-bg.png" />
</div>
CSS (png fallback):
#supports not(mix-blend-mode: multiply) {
.blender {
display: block;
}
.willItBlend {
display: none;
}
SVG:
<svg width="489" height="441" viewBox="0 0 489 441" xmlns="http://www.w3.org/2000/svg">
<title>
about-bg
</title>
<style>
path { mix-blend-mode: multiply; }
ellipse { mix-blend-mode: multiply; }
</style>
<g fill="none" fill-rule="evenodd">
<g transform="translate(-236.973 -308)" stroke-width="33.6">
<ellipse stroke="#E2E42E" cx="345.986" cy="357.28" rx="345.986" ry="357.28"/>
<ellipse stroke="#ED1F71" cx="346.972" cy="358.298" rx="295.715" ry="305.368"/>
<ellipse stroke="#03A8DE" cx="346.972" cy="358.298" rx="244.458" ry="252.437"/>
</g>
<g transform="translate(-284 -294.56)">
<path d="M345.986 714.56c191.083 0 345.987-159.96 345.987-357.28C691.973 159.96 537.07 0 345.986 0 154.903 0 0 159.96 0 357.28 0 554.6 154.903 714.56 345.986 714.56z" stroke="#E2E42E" stroke-width="11.2"/>
<ellipse stroke="#ED1F71" stroke-width="22.4" cx="346.972" cy="358.298" rx="295.715" ry="305.368"/>
<ellipse stroke="#03A8DE" stroke-width="22.4" cx="346.972" cy="358.298" rx="244.458" ry="252.437"/>
</g>
<g transform="translate(-138.44 -164.64)">
<path d="M247.453 510.72c136.665 0 247.453-114.33 247.453-255.36C494.906 114.33 384.118 0 247.453 0 110.788 0 0 114.33 0 255.36c0 141.03 110.788 255.36 247.453 255.36z" stroke="#E2E42E" stroke-width="11.2"/>
<ellipse stroke="#ED1F71" stroke-width="5.6" cx="248.573" cy="256.48" rx="211.623" ry="218.4"/>
<ellipse stroke="#03A8DE" stroke-width="5.6" cx="247.453" cy="256.48" rx="174.673" ry="180.32"/>
</g>
</g>
</svg>

Resources