How do I make a semi transparent background?

I need to make a white background 50% transparent without affecting anything else. How do I do it?


Use rgba() :

.transparent{
  background:rgba(255,255,255,0.5);
}

This will give you 50% opacity while the content of the box will continue to have 100% opacity.

If you use opacity:0.5 , the content will be faded as well as the background. Hence do not use it.


这是有效的,但是这个班的所有孩子也会变得模糊,没有任何阻止的方法。

.css-class-name {
    opacity:0.8;
}

如果你想让透明背景为灰色,请尝试:

   .transparent{
       background:rgba(1,1,1,0.5);
   }
链接地址: http://www.djcxy.com/p/15798.html

上一篇: 如何使用少编译器将HEX颜色转换为rgba?

下一篇: 我如何制作半透明背景?