CSS background url SVG fill color not working (not base64) when compiling from SASS [duplicate] Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar Manara Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!SVG data image not working on Firefox or Chrome 72+When to use IMG vs. CSS background-image?XPointers in SVGSVG viewBox to VML coordorigin/coordsizeCSS opacity only to background color, not the text on it?SVG fill color transparency / alpha?Fill SVG path with a background-image without knowing height&widthHow to change color of SVG image using CSS (jQuery SVG image replacement)?Change color of data url embedded SVG imageCanvg conversion - weird behavior when using a fill urlHow use image/svg+xml in JMeter

Like totally amazing interchangeable sister outfit accessory swapping or whatever

Simulate round-robin tournament draw

Philosophers who were composers?

Why is arima in R one time step off?

When I export an AI 300x60 art board it saves with bigger dimensions

Arriving in Atlanta after US Preclearance in Dublin. Will I go through TSA security in Atlanta to transfer to a connecting flight?

Was there ever a LEGO store in Miami International Airport?

Getting AggregateResult variables from Execute Anonymous Window

Raising a bilingual kid. When should we introduce the majority language?

Processing ADC conversion result: DMA vs Processor Registers

A journey... into the MIND

Coin Game with infinite paradox

"Working on a knee"

Bright yellow or light yellow?

When speaking, how do you change your mind mid-sentence?

How was Lagrange appointed professor of mathematics so early?

Why doesn't the university give past final exams' answers?

What happened to Viserion in Season 7?

How to translate "red flag" into Spanish?

When does Bran Stark remember Jamie pushing him?

How can I wire a 9-position switch so that each position turns on one more LED than the one before?

Are there existing rules/lore for MTG planeswalkers?

Is there a verb for listening stealthily?

Is it OK if I do not take the receipt in Germany?



CSS background url SVG fill color not working (not base64) when compiling from SASS [duplicate]



Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar Manara
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!SVG data image not working on Firefox or Chrome 72+When to use IMG vs. CSS background-image?XPointers in SVGSVG viewBox to VML coordorigin/coordsizeCSS opacity only to background color, not the text on it?SVG fill color transparency / alpha?Fill SVG path with a background-image without knowing height&widthHow to change color of SVG image using CSS (jQuery SVG image replacement)?Change color of data url embedded SVG imageCanvg conversion - weird behavior when using a fill urlHow use image/svg+xml in JMeter



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1
















This question already has an answer here:



  • SVG data image not working on Firefox or Chrome 72+

    3 answers



I'm using SASS to generate my css and i'm trying to create a dotted repeated pattern to simulate a border-bottom on abbr tags using a background image image SVG.



I've searched deep but can't find a solution as i'm using sass to modify the fill color for specific site accents using parent class.



The fill is on the <rect ... /> element in the SVG.



This is my sass below...



ABBR 
text-decoration: none !important;
cursor: default !important;
border: none;
position: relative;

&:after
content: '';
display: block;
position: absolute;
left: 0;
right: 0;
bottom: -2px;
height: 1px;
background:
image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#$body-color" /></svg>');
repeat: repeat;


@include accent-colors
background:
image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#$accent-color" /></svg>') !important;








This is my compiled CSS and as you can see my fill colors are outputting fine.



ABBR 
text-decoration: none !important;
cursor: default !important;
border: none;
position: relative;

ABBR:after
content: '';
display: block;
position: absolute;
left: 0;
right: 0;
bottom: -2px;
height: 1px;
background-image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#393e44" /></svg>');
background-repeat: repeat;

.accent-green ABBR:after
background-image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#96d63d" /></svg>') !important;

.accent-blue ABBR:after
background-image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#5e80f6" /></svg>') !important;

.accent-teal ABBR:after
background-image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#2fb8cd" /></svg>') !important;

.accent-pink ABBR:after
background-image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#ff6e9e" /></svg>') !important;

.accent-purple ABBR:after
background-image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#ca63e5" /></svg>') !important;

.accent-orange ABBR:after
background-image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#fd923a" /></svg>') !important;

.accent-red ABBR:after
background-image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#e73e50" /></svg>') !important;




And when i'm viewing the element css using the inspector, there appears to be no errors and its using the correct accent class SVG background. But no fill color is showing.



enter image description here





I've upload the SVG code as an .svg file. When you zoom in you can see the fill on the SVG rect element is pink and working. The code is copied directly from Chrome's web inspector. So it's really bizarre why this does not work in the css background image attribute. Check it out below.



SVG https://a.uguu.se/ZvcDJWMpf5fl_accent-pink.svg





See this link below for an exact repo of my problem in jsfiddle using sass.



Fiddle https://jsfiddle.net/joshmoto/j8on1b9v/



If you inspect the :after element in the dom and remove the # from the rect fill color value you will see the SVG works but it's displaying black. Or check out this version where i've removed the # using a string replace function.




Fiddle https://jsfiddle.net/joshmoto/L1g5fo34/2/



The SVG works, but again black, so not working entirely.










share|improve this question















marked as duplicate by Robert Longson svg
Users with the  svg badge can single-handedly close svg questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Mar 9 at 8:32


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


















  • try to encode the image like this: background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='2' height='1'%3E%3Crect width='1' height='1' fill='%23393e44' /%3E%3C/svg%3E"); This: %23 instead of # and other replacements.

    – enxaneta
    Mar 9 at 7:15












  • Just encoding the # seemed to do the trick. Thanks for your comment.

    – joshmoto
    Mar 9 at 16:20

















1
















This question already has an answer here:



  • SVG data image not working on Firefox or Chrome 72+

    3 answers



I'm using SASS to generate my css and i'm trying to create a dotted repeated pattern to simulate a border-bottom on abbr tags using a background image image SVG.



I've searched deep but can't find a solution as i'm using sass to modify the fill color for specific site accents using parent class.



The fill is on the <rect ... /> element in the SVG.



This is my sass below...



ABBR 
text-decoration: none !important;
cursor: default !important;
border: none;
position: relative;

&:after
content: '';
display: block;
position: absolute;
left: 0;
right: 0;
bottom: -2px;
height: 1px;
background:
image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#$body-color" /></svg>');
repeat: repeat;


@include accent-colors
background:
image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#$accent-color" /></svg>') !important;








This is my compiled CSS and as you can see my fill colors are outputting fine.



ABBR 
text-decoration: none !important;
cursor: default !important;
border: none;
position: relative;

ABBR:after
content: '';
display: block;
position: absolute;
left: 0;
right: 0;
bottom: -2px;
height: 1px;
background-image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#393e44" /></svg>');
background-repeat: repeat;

.accent-green ABBR:after
background-image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#96d63d" /></svg>') !important;

.accent-blue ABBR:after
background-image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#5e80f6" /></svg>') !important;

.accent-teal ABBR:after
background-image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#2fb8cd" /></svg>') !important;

.accent-pink ABBR:after
background-image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#ff6e9e" /></svg>') !important;

.accent-purple ABBR:after
background-image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#ca63e5" /></svg>') !important;

.accent-orange ABBR:after
background-image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#fd923a" /></svg>') !important;

.accent-red ABBR:after
background-image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#e73e50" /></svg>') !important;




And when i'm viewing the element css using the inspector, there appears to be no errors and its using the correct accent class SVG background. But no fill color is showing.



enter image description here





I've upload the SVG code as an .svg file. When you zoom in you can see the fill on the SVG rect element is pink and working. The code is copied directly from Chrome's web inspector. So it's really bizarre why this does not work in the css background image attribute. Check it out below.



SVG https://a.uguu.se/ZvcDJWMpf5fl_accent-pink.svg





See this link below for an exact repo of my problem in jsfiddle using sass.



Fiddle https://jsfiddle.net/joshmoto/j8on1b9v/



If you inspect the :after element in the dom and remove the # from the rect fill color value you will see the SVG works but it's displaying black. Or check out this version where i've removed the # using a string replace function.




Fiddle https://jsfiddle.net/joshmoto/L1g5fo34/2/



The SVG works, but again black, so not working entirely.










share|improve this question















marked as duplicate by Robert Longson svg
Users with the  svg badge can single-handedly close svg questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Mar 9 at 8:32


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


















  • try to encode the image like this: background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='2' height='1'%3E%3Crect width='1' height='1' fill='%23393e44' /%3E%3C/svg%3E"); This: %23 instead of # and other replacements.

    – enxaneta
    Mar 9 at 7:15












  • Just encoding the # seemed to do the trick. Thanks for your comment.

    – joshmoto
    Mar 9 at 16:20













1












1








1









This question already has an answer here:



  • SVG data image not working on Firefox or Chrome 72+

    3 answers



I'm using SASS to generate my css and i'm trying to create a dotted repeated pattern to simulate a border-bottom on abbr tags using a background image image SVG.



I've searched deep but can't find a solution as i'm using sass to modify the fill color for specific site accents using parent class.



The fill is on the <rect ... /> element in the SVG.



This is my sass below...



ABBR 
text-decoration: none !important;
cursor: default !important;
border: none;
position: relative;

&:after
content: '';
display: block;
position: absolute;
left: 0;
right: 0;
bottom: -2px;
height: 1px;
background:
image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#$body-color" /></svg>');
repeat: repeat;


@include accent-colors
background:
image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#$accent-color" /></svg>') !important;








This is my compiled CSS and as you can see my fill colors are outputting fine.



ABBR 
text-decoration: none !important;
cursor: default !important;
border: none;
position: relative;

ABBR:after
content: '';
display: block;
position: absolute;
left: 0;
right: 0;
bottom: -2px;
height: 1px;
background-image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#393e44" /></svg>');
background-repeat: repeat;

.accent-green ABBR:after
background-image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#96d63d" /></svg>') !important;

.accent-blue ABBR:after
background-image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#5e80f6" /></svg>') !important;

.accent-teal ABBR:after
background-image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#2fb8cd" /></svg>') !important;

.accent-pink ABBR:after
background-image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#ff6e9e" /></svg>') !important;

.accent-purple ABBR:after
background-image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#ca63e5" /></svg>') !important;

.accent-orange ABBR:after
background-image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#fd923a" /></svg>') !important;

.accent-red ABBR:after
background-image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#e73e50" /></svg>') !important;




And when i'm viewing the element css using the inspector, there appears to be no errors and its using the correct accent class SVG background. But no fill color is showing.



enter image description here





I've upload the SVG code as an .svg file. When you zoom in you can see the fill on the SVG rect element is pink and working. The code is copied directly from Chrome's web inspector. So it's really bizarre why this does not work in the css background image attribute. Check it out below.



SVG https://a.uguu.se/ZvcDJWMpf5fl_accent-pink.svg





See this link below for an exact repo of my problem in jsfiddle using sass.



Fiddle https://jsfiddle.net/joshmoto/j8on1b9v/



If you inspect the :after element in the dom and remove the # from the rect fill color value you will see the SVG works but it's displaying black. Or check out this version where i've removed the # using a string replace function.




Fiddle https://jsfiddle.net/joshmoto/L1g5fo34/2/



The SVG works, but again black, so not working entirely.










share|improve this question

















This question already has an answer here:



  • SVG data image not working on Firefox or Chrome 72+

    3 answers



I'm using SASS to generate my css and i'm trying to create a dotted repeated pattern to simulate a border-bottom on abbr tags using a background image image SVG.



I've searched deep but can't find a solution as i'm using sass to modify the fill color for specific site accents using parent class.



The fill is on the <rect ... /> element in the SVG.



This is my sass below...



ABBR 
text-decoration: none !important;
cursor: default !important;
border: none;
position: relative;

&:after
content: '';
display: block;
position: absolute;
left: 0;
right: 0;
bottom: -2px;
height: 1px;
background:
image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#$body-color" /></svg>');
repeat: repeat;


@include accent-colors
background:
image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#$accent-color" /></svg>') !important;








This is my compiled CSS and as you can see my fill colors are outputting fine.



ABBR 
text-decoration: none !important;
cursor: default !important;
border: none;
position: relative;

ABBR:after
content: '';
display: block;
position: absolute;
left: 0;
right: 0;
bottom: -2px;
height: 1px;
background-image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#393e44" /></svg>');
background-repeat: repeat;

.accent-green ABBR:after
background-image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#96d63d" /></svg>') !important;

.accent-blue ABBR:after
background-image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#5e80f6" /></svg>') !important;

.accent-teal ABBR:after
background-image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#2fb8cd" /></svg>') !important;

.accent-pink ABBR:after
background-image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#ff6e9e" /></svg>') !important;

.accent-purple ABBR:after
background-image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#ca63e5" /></svg>') !important;

.accent-orange ABBR:after
background-image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#fd923a" /></svg>') !important;

.accent-red ABBR:after
background-image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#e73e50" /></svg>') !important;




And when i'm viewing the element css using the inspector, there appears to be no errors and its using the correct accent class SVG background. But no fill color is showing.



enter image description here





I've upload the SVG code as an .svg file. When you zoom in you can see the fill on the SVG rect element is pink and working. The code is copied directly from Chrome's web inspector. So it's really bizarre why this does not work in the css background image attribute. Check it out below.



SVG https://a.uguu.se/ZvcDJWMpf5fl_accent-pink.svg





See this link below for an exact repo of my problem in jsfiddle using sass.



Fiddle https://jsfiddle.net/joshmoto/j8on1b9v/



If you inspect the :after element in the dom and remove the # from the rect fill color value you will see the SVG works but it's displaying black. Or check out this version where i've removed the # using a string replace function.




Fiddle https://jsfiddle.net/joshmoto/L1g5fo34/2/



The SVG works, but again black, so not working entirely.





This question already has an answer here:



  • SVG data image not working on Firefox or Chrome 72+

    3 answers







css svg sass fill






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 9 at 16:32







joshmoto

















asked Mar 9 at 4:52









joshmotojoshmoto

978414




978414




marked as duplicate by Robert Longson svg
Users with the  svg badge can single-handedly close svg questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Mar 9 at 8:32


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by Robert Longson svg
Users with the  svg badge can single-handedly close svg questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Mar 9 at 8:32


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • try to encode the image like this: background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='2' height='1'%3E%3Crect width='1' height='1' fill='%23393e44' /%3E%3C/svg%3E"); This: %23 instead of # and other replacements.

    – enxaneta
    Mar 9 at 7:15












  • Just encoding the # seemed to do the trick. Thanks for your comment.

    – joshmoto
    Mar 9 at 16:20

















  • try to encode the image like this: background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='2' height='1'%3E%3Crect width='1' height='1' fill='%23393e44' /%3E%3C/svg%3E"); This: %23 instead of # and other replacements.

    – enxaneta
    Mar 9 at 7:15












  • Just encoding the # seemed to do the trick. Thanks for your comment.

    – joshmoto
    Mar 9 at 16:20
















try to encode the image like this: background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='2' height='1'%3E%3Crect width='1' height='1' fill='%23393e44' /%3E%3C/svg%3E"); This: %23 instead of # and other replacements.

– enxaneta
Mar 9 at 7:15






try to encode the image like this: background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='2' height='1'%3E%3Crect width='1' height='1' fill='%23393e44' /%3E%3C/svg%3E"); This: %23 instead of # and other replacements.

– enxaneta
Mar 9 at 7:15














Just encoding the # seemed to do the trick. Thanks for your comment.

– joshmoto
Mar 9 at 16:20





Just encoding the # seemed to do the trick. Thanks for your comment.

– joshmoto
Mar 9 at 16:20












1 Answer
1






active

oldest

votes


















2














In svg, # needs to be encoded, and replaced with %23.



So you need to create a function to do the replacement. I.E.:



@function url-encoded-color($color) 
@return '%23' + str-slice('#$color', 2, -1)



And then for svg, place it instead of variable directly:



 background: 
image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#url-encoded-color($body-color)" /></svg>');
repeat: repeat;



Full example:
https://jsfiddle.net/niklaz/26Ljsmdu/3/






share|improve this answer


















  • 1





    Bingo, thank you worked a beaut.

    – joshmoto
    Mar 9 at 16:18

















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














In svg, # needs to be encoded, and replaced with %23.



So you need to create a function to do the replacement. I.E.:



@function url-encoded-color($color) 
@return '%23' + str-slice('#$color', 2, -1)



And then for svg, place it instead of variable directly:



 background: 
image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#url-encoded-color($body-color)" /></svg>');
repeat: repeat;



Full example:
https://jsfiddle.net/niklaz/26Ljsmdu/3/






share|improve this answer


















  • 1





    Bingo, thank you worked a beaut.

    – joshmoto
    Mar 9 at 16:18















2














In svg, # needs to be encoded, and replaced with %23.



So you need to create a function to do the replacement. I.E.:



@function url-encoded-color($color) 
@return '%23' + str-slice('#$color', 2, -1)



And then for svg, place it instead of variable directly:



 background: 
image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#url-encoded-color($body-color)" /></svg>');
repeat: repeat;



Full example:
https://jsfiddle.net/niklaz/26Ljsmdu/3/






share|improve this answer


















  • 1





    Bingo, thank you worked a beaut.

    – joshmoto
    Mar 9 at 16:18













2












2








2







In svg, # needs to be encoded, and replaced with %23.



So you need to create a function to do the replacement. I.E.:



@function url-encoded-color($color) 
@return '%23' + str-slice('#$color', 2, -1)



And then for svg, place it instead of variable directly:



 background: 
image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#url-encoded-color($body-color)" /></svg>');
repeat: repeat;



Full example:
https://jsfiddle.net/niklaz/26Ljsmdu/3/






share|improve this answer













In svg, # needs to be encoded, and replaced with %23.



So you need to create a function to do the replacement. I.E.:



@function url-encoded-color($color) 
@return '%23' + str-slice('#$color', 2, -1)



And then for svg, place it instead of variable directly:



 background: 
image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="2" height="1"><rect width="1" height="1" fill="#url-encoded-color($body-color)" /></svg>');
repeat: repeat;



Full example:
https://jsfiddle.net/niklaz/26Ljsmdu/3/







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 9 at 6:31









niklazniklaz

2,07511318




2,07511318







  • 1





    Bingo, thank you worked a beaut.

    – joshmoto
    Mar 9 at 16:18












  • 1





    Bingo, thank you worked a beaut.

    – joshmoto
    Mar 9 at 16:18







1




1





Bingo, thank you worked a beaut.

– joshmoto
Mar 9 at 16:18





Bingo, thank you worked a beaut.

– joshmoto
Mar 9 at 16:18





Popular posts from this blog

Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved