CSS 使引导程序半透明
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18274976/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Make bootstrap well semi transparent
提问by SoWhat
I tried to make the bootstrap well semi transparent by adding opacity:0.4
but this results in making the text semitransparent as well. Is there any way to make the well semi transparent without making the body lose opacity as well.
我试图通过添加使引导程序半透明,opacity:0.4
但这也会导致文本半透明。有什么方法可以使井半透明而不使身体也失去不透明度。
回答by Hieu Le
Change the background-color
instead of changing its opacity
改变background-color
而不是改变它opacity
.well {
background-color: rgba(245, 245, 245, 0.4);
}
With a notice that the value 245
comes from the default background-color
of the .well
class: #F5F5F5
.
随着公告称,值245
来自默认background-color
的的.well
类:#F5F5F5
。
回答by Kees Sonnema
There's an awesome way of doing this.
You can do it using rgba
and 'background-color` like this:
有一种很棒的方法可以做到这一点。你可以rgba
像这样使用和 'background-color`来做到这一点:
.well{
background-color: rgba(255,255,255,0.4); // I don't know the .well color, so I used white as example
}
where the 0.4
is the opacity and the 255,255,255 the color codes in rgb.
其中0.4
是不透明度,255,255,255 是 rgb 中的颜色代码。
More about rgba:
更多关于RGBA: