如何使透明背景没有背景图像? [英] How to make a transparent background without background image?
问题描述
我想要一个 div
有一个透明的背景。
我试图这样做使用 background-color
和 opacity
,但问题是边框和文本内部也变得透明。 这里的示例
I would like a div
to have a transparent background.
I tried to do this using background-color
and opacity
, but the problem is that the border and the text inside become also transparent. Example here.
这是可能实现的这不使用透明的PNG背景图像?
Is this possible to achieve this without using transparent PNG background image ?
推荐答案
如果你只是想让背景的颜色是透明的, ,使用
If you just want the color of the background to be transparent and not the child content, use
background-color:rgba(0,0,0,.5); //设置为50%透明
有关详细信息,请参阅此页面 - 这是一个css3规范,因此不会显示在每个浏览器:
See this page for more details - it's a css3 spec so won't show up in every browser:
http:// www。 css3.info/introduction-opacity-rgba/
这篇关于如何使透明背景没有背景图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!