Style SVG with CSS to include background-image? [duplicate]





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







0
















This question already has an answer here:




  • Fill SVG path element with a background-image

    2 answers



  • Add a background image (.png) to a SVG circle shape

    5 answers




I need to include an image via CSS to an existing SVG image that I have displayed on my webpage. Is this something possible to achieve?



I tried with background-image but it doesn't seem to work.



Quick codepen with background-image not working: https://codepen.io/anon/pen/rQrzGZ



<svg height="400" width="400">
<circle cx="250" cy="250" r="100" stroke="black" stroke-width="3" fill="red" style="background-image: url('https://via.placeholder.com/140x100')"/>

</svg>


Please note similar questions are about adding a background image to a SVG using SVG elements while I need to exclusively need to add the image via CSS styling of a SVG.










share|improve this question















marked as duplicate by Temani Afif css
Users with the  css badge can single-handedly close css 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();
}
);
});
});
Nov 26 '18 at 22:05


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.



















  • Why are you using an SVG any particular reason?

    – Dylan Anlezark
    Nov 26 '18 at 21:41











  • Simluar question like that: stackoverflow.com/questions/11496734/… ?

    – episch
    Nov 26 '18 at 22:06











  • @episch this is not the same question. Linked question is about achieving a background image on a SVG while I want to add a background image to a SVG but by using CSS to add that background.

    – AlfaTeK
    Nov 27 '18 at 23:55


















0
















This question already has an answer here:




  • Fill SVG path element with a background-image

    2 answers



  • Add a background image (.png) to a SVG circle shape

    5 answers




I need to include an image via CSS to an existing SVG image that I have displayed on my webpage. Is this something possible to achieve?



I tried with background-image but it doesn't seem to work.



Quick codepen with background-image not working: https://codepen.io/anon/pen/rQrzGZ



<svg height="400" width="400">
<circle cx="250" cy="250" r="100" stroke="black" stroke-width="3" fill="red" style="background-image: url('https://via.placeholder.com/140x100')"/>

</svg>


Please note similar questions are about adding a background image to a SVG using SVG elements while I need to exclusively need to add the image via CSS styling of a SVG.










share|improve this question















marked as duplicate by Temani Afif css
Users with the  css badge can single-handedly close css 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();
}
);
});
});
Nov 26 '18 at 22:05


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.



















  • Why are you using an SVG any particular reason?

    – Dylan Anlezark
    Nov 26 '18 at 21:41











  • Simluar question like that: stackoverflow.com/questions/11496734/… ?

    – episch
    Nov 26 '18 at 22:06











  • @episch this is not the same question. Linked question is about achieving a background image on a SVG while I want to add a background image to a SVG but by using CSS to add that background.

    – AlfaTeK
    Nov 27 '18 at 23:55














0












0








0









This question already has an answer here:




  • Fill SVG path element with a background-image

    2 answers



  • Add a background image (.png) to a SVG circle shape

    5 answers




I need to include an image via CSS to an existing SVG image that I have displayed on my webpage. Is this something possible to achieve?



I tried with background-image but it doesn't seem to work.



Quick codepen with background-image not working: https://codepen.io/anon/pen/rQrzGZ



<svg height="400" width="400">
<circle cx="250" cy="250" r="100" stroke="black" stroke-width="3" fill="red" style="background-image: url('https://via.placeholder.com/140x100')"/>

</svg>


Please note similar questions are about adding a background image to a SVG using SVG elements while I need to exclusively need to add the image via CSS styling of a SVG.










share|improve this question

















This question already has an answer here:




  • Fill SVG path element with a background-image

    2 answers



  • Add a background image (.png) to a SVG circle shape

    5 answers




I need to include an image via CSS to an existing SVG image that I have displayed on my webpage. Is this something possible to achieve?



I tried with background-image but it doesn't seem to work.



Quick codepen with background-image not working: https://codepen.io/anon/pen/rQrzGZ



<svg height="400" width="400">
<circle cx="250" cy="250" r="100" stroke="black" stroke-width="3" fill="red" style="background-image: url('https://via.placeholder.com/140x100')"/>

</svg>


Please note similar questions are about adding a background image to a SVG using SVG elements while I need to exclusively need to add the image via CSS styling of a SVG.





This question already has an answer here:




  • Fill SVG path element with a background-image

    2 answers



  • Add a background image (.png) to a SVG circle shape

    5 answers








html css svg






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 27 '18 at 23:56







AlfaTeK

















asked Nov 26 '18 at 21:38









AlfaTeKAlfaTeK

4,063103976




4,063103976




marked as duplicate by Temani Afif css
Users with the  css badge can single-handedly close css 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();
}
);
});
});
Nov 26 '18 at 22:05


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 Temani Afif css
Users with the  css badge can single-handedly close css 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();
}
);
});
});
Nov 26 '18 at 22:05


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.















  • Why are you using an SVG any particular reason?

    – Dylan Anlezark
    Nov 26 '18 at 21:41











  • Simluar question like that: stackoverflow.com/questions/11496734/… ?

    – episch
    Nov 26 '18 at 22:06











  • @episch this is not the same question. Linked question is about achieving a background image on a SVG while I want to add a background image to a SVG but by using CSS to add that background.

    – AlfaTeK
    Nov 27 '18 at 23:55



















  • Why are you using an SVG any particular reason?

    – Dylan Anlezark
    Nov 26 '18 at 21:41











  • Simluar question like that: stackoverflow.com/questions/11496734/… ?

    – episch
    Nov 26 '18 at 22:06











  • @episch this is not the same question. Linked question is about achieving a background image on a SVG while I want to add a background image to a SVG but by using CSS to add that background.

    – AlfaTeK
    Nov 27 '18 at 23:55

















Why are you using an SVG any particular reason?

– Dylan Anlezark
Nov 26 '18 at 21:41





Why are you using an SVG any particular reason?

– Dylan Anlezark
Nov 26 '18 at 21:41













Simluar question like that: stackoverflow.com/questions/11496734/… ?

– episch
Nov 26 '18 at 22:06





Simluar question like that: stackoverflow.com/questions/11496734/… ?

– episch
Nov 26 '18 at 22:06













@episch this is not the same question. Linked question is about achieving a background image on a SVG while I want to add a background image to a SVG but by using CSS to add that background.

– AlfaTeK
Nov 27 '18 at 23:55





@episch this is not the same question. Linked question is about achieving a background image on a SVG while I want to add a background image to a SVG but by using CSS to add that background.

– AlfaTeK
Nov 27 '18 at 23:55












0






active

oldest

votes

















0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

To store a contact into the json file from server.js file using a class in NodeJS

Redirect URL with Chrome Remote Debugging Android Devices

Dieringhausen