0

circle {
    fill: rgba(248, 248, 248, 0.5);
}
<svg width='400' height='400'>
    <circle r='100' cx='200' cy='200'></circle>
</svg>

rgb code works for this, but I found rgba doesn't work. The shapes become invisible. I tested this on Chrome and Firefox.

Am I missing something else here?

Robert Longson
  • 118,664
  • 26
  • 252
  • 242
artemismars
  • 138
  • 2
  • 9
  • 2
    it works for me but your circle is so pale against a white background, it's basically invisible. – Robert Longson Mar 18 '21 at 07:28
  • 1
    In your case the color is a very light grey - almost white. This is why it _seam_ it doesn't to work. If you change the color to something else like `fill: rgba(248, 0, 0, 0.5);` you'll see it works – enxaneta Mar 18 '21 at 07:30

1 Answers1

2

The circle is almost white and also partially transparent, you just can't see it against a white background.

On a black background you can see it's rendered perfectly OK by both Firefox and Chrome...

svg {
    background-color: black;
}

circle {
    fill: rgba(248, 248, 248, 0.5);
}
<svg width='400' height='400'>
    <circle r='100' cx='200' cy='200'></circle>
</svg>
Robert Longson
  • 118,664
  • 26
  • 252
  • 242