How to Make a Div transparent with background color
This question already has an answer here:
You need to convert the color to rbg so you can use it with the rgba()
property.
In this case, what you are after is:
background-color: rgba(90, 125, 0, 0.5);
The last of those 4 values being the opacity level ( 0.5
)
You must convert the Hex Color Format to RBG Color format as this format includes Alpha Transparency. Which allows us to make only parent container transparent without changing the transparency of the child containers. In RBG format first 3 values are RBG color values and fourth is the Opacity value ranging between 0 to 1.
So your code should look like :
background-color: rgba(90, 125, 0, 0.5);
链接地址: http://www.djcxy.com/p/28090.html
上一篇: 半透明的背景颜色,但不是文字
下一篇: 如何使背景颜色透明Div