本文介绍了背景颜色的不透明度,但不是文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在文本保持不透明的情况下使 div 的背景透明化跨浏览器(包括Internet Explorer 6)?

How do I make the cross-browser (including Internet Explorer 6) transparency for the background of a div while the text remains opaque?

我需要这样做,而不使用任何库,如jQuery等(但如果你知道一个库,它会的,我很想知道,所以我可以看看他们的代码)。

I need to do it without using any library such as jQuery, etc. (But if you know of a library that does it I'd love to know so I can look at their code).

推荐答案

使用rgba!

.alpha60 {
    /* Fallback for web browsers that don't support RGBa */
    background-color: rgb(0, 0, 0);
    /* RGBa with 0.6 opacity */
    background-color: rgba(0, 0, 0, 0.6);
    /* For IE 5.5 - 7*/
    filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000);
    /* For IE 8*/
    -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000)";
}



通过

这篇关于背景颜色的不透明度,但不是文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 23:57
查看更多