简体   繁体   English

rgba 不适用于 CSS 中的填充属性

[英]rgba doesn't work for fill property in CSS

 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. rgb 代码适用于此,但我发现 rgba 不起作用。 The shapes become invisible.形状变得不可见。 I tested this on Chrome and Firefox.我在 Chrome 和 Firefox 上对此进行了测试。

Am I missing something else here?我在这里错过了其他东西吗?

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...在黑色背景上,您可以看到 Firefox 和 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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM