svg images and making the background transparent
How do y开发者_开发百科ou declare the background of an svg
script image to be transparent?
If you're viewing in a browser then the background should be transparent automatically. At least it is in FF4 and the latest version of Chrome, but not in some older browsers (e.g. http://petercollingridge.co.uk/data-visualisation/mouseover-effects-svgs).
If you want the background to be semi-transparent then fill the space with a <rect>
and set its opacity to a number between 0 and less than 1.
Even easier method is to delete all the data that is used in the file content
Here is a sample before:
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" width="24.000000pt" height="24.000000pt" viewBox="0 0 24.000000 24.000000" preserveAspectRatio="xMidYMid meet">
Here is a sample after
<g transform="translate(0.000000,24.000000) scale(0.100000,-0.100000)" fill="#ff0000" stroke="none">
<path d=""/>
</g>
</svg>
Remove all the data between
精彩评论