What is the difference in opacity
vs fill-opacity
in SVG?
I referred the docs for fill-opacity and opacity but I am confused what is meant by
In addition to affecting which parts of each individual element are affected (e.g. fill versus stroke) another difference is what happens when elements overlap within a group. opacity
affects the transparency of the group as a whole while fill-opacity
affects the transparency of the individual elements within the group. One consequence of this is that when elements within such a group overlap, there is a compounding effect in the region of overlap when fill-opacity
is used but not when opacity
is used. This is demonstrated in the image below when a (fill-)opacity of 0.5 is applied to either each element within a group or to the group itself.