透明的PNG标签,不使用alpha? [英] Transparent PNG in a div tag, not using alpha?
问题描述
我开始学习CSS时遇到了一个奇怪的问题。 这是一个测试页面。它有一个大的透明PNG覆盖了纯蓝的背景色。
I have an odd issue while beginning to learn CSS. This is a test page. It has a large transparent PNG covering the background color of solid blue.
通常情况下,黑色图像(里面有透明孔)完全遮住了我的背景色。
Typically the black image (which has transparent holes in it) completely blacks out my background color.
这个示例页面让图片的div透明,以查看背景是否仍然有效。
In this example page I made the image's div transparent just to see if the background was still working.
任何想法为什么我的alpha会被完全忽略?
Any ideas why my alpha is getting completely ignored?
谢谢大家。
推荐答案
这是因为在 .backgrounddiv
你有
background-color
设为#000
。请使用透明
来修复:
It's because on .backgrounddiv
you have background-color
set to #000
. Instead use transparent
to fix:
.backgrounddiv {
position:absolute;
background-color: transparent;
background-image:url(POCTransparentBG.png);
...
这篇关于透明的PNG标签,不使用alpha?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!