html - Applying CSS to img-tag-embedded SVG images -


on page i'm using img tag embed svg images. wanted apply css onto them. works long copypaste svg source code directly page. however, if embed them using img src attribute, doesn't.

is there way make work?

<style type="text/css"> path:hover {     fill:white; } </style>  <img src="my.svg" /> 

thanks in advance!

well can achieved through jquery ( work around ) , jquery function convert <img> tag hold current svg image <svg> inline tags, can view in browser debugger.in short mimic if directly inserted svg image.

<script type="text/javascript">      $(document).ready(function() {         $('#img').each(function(){             var img         = $(this);             var image_uri   = img.attr('src');              $.get(image_uri, function(data) {                 var svg = $(data).find('svg');                 svg.removeattr('xmlns:a');                 img.replacewith(svg);             }, 'xml');          });     }); </script>   <img id='img' src="my.svg" /> 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -