如何使透明背景没有背景图像? [英] How to make a transparent background without background image?

查看:128
本文介绍了如何使透明背景没有背景图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一个 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆