Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 如何为元素';她只有背景吗?_Css - Fatal编程技术网

Css 如何为元素';她只有背景吗?

Css 如何为元素';她只有背景吗?,css,Css,如何仅为背景提供跨浏览器透明度 我想让ul{background:}的背景透明,但我不想让ulli内部的文本透明 ul { filter: alpha(opacity=50); /* internet explorer */ -khtml-opacity: 0.5; /* khtml, old safari */ -moz-opacity: 0.5; /* mozilla, netscape */ opacity: 0.5;

如何仅为背景提供跨浏览器透明度

我想让
ul{background:}
的背景透明,但我不想让
ulli内部的文本透明

ul {
    filter: alpha(opacity=50); /* internet explorer */
    -khtml-opacity: 0.5;      /* khtml, old safari */
    -moz-opacity: 0.5;       /* mozilla, netscape */
    opacity: 0.5;           /* fx, safari, opera */
}

此代码使所有内容透明

您可以使用RGBA颜色。我已经为你们做了一个例子:

以下是IE和兼容列表的解决方法:

我使用透明PNG作为背景来解决这个问题老实说,我认为透明PNG是最安全的方式。
ul {
 background: rgba(255, 255, 255, 0.5) //white with opcaity of 50%
}

ul li {
 color: #fff;
 background: rgba(0, 0, 0, 0.5) //black with opcaity of 50%
}