Search code examples
backgroundsvg

svg images and making the background transparent


How do you declare the background of an svg script image to be transparent?


Solution

  • 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.