如何给浏览器透明度元素的背景? [英] How to give cross browser transparency to element's background only?

查看:111
本文介绍了如何给浏览器透明度元素的背景?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

How to give cross browser transparency to background only?

我想给予 ul {background:}背景透明只是不想在 ul li a {} 透明。

I want to give transparency to background of ul { background: } only don't want to make text inside ul li a {} transparent.

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 */
}

href =http://perishablepress.com/press/2009/01/27/cross-browser-transparency-via-css/ =nofollow noreferrer> http://perishablepress.com/press/2009/01 / 27> /

this code make everything transparent http://perishablepress.com/press/2009/01/27/cross-browser-transparency-via-css/

推荐答案

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

you can use RGBA colors. I have made up an example for you:

http:/ /jsfiddle.net/ypaTH/

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%
}

这里是IE和兼容列表的解决方法:
http://css-tricks.com/rgba-browser-support/

here is a workaround for IE and the compatibly list: http://css-tricks.com/rgba-browser-support/

这篇关于如何给浏览器透明度元素的背景?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆