CSS - 不透明文本在低不透明度div? [英] CSS - Opaque text on low opacity div?

查看:90
本文介绍了CSS - 不透明文本在低不透明度div?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有60%不透明度的div,以显示div后面的背景图片的一部分。因为不透明度为60%,所以该div中的文本将显示为灰色。



是否还要覆盖此级别并使文本显示为黑色?

任何赞赏的建议。



谢谢。

解决方案

在背景而不是元素上设置不透明度。

  background-color:rgba 0,0,0.6); 

前面我写了关于如何以向后兼容的方式实现此功能


I have a div with 60% opacity, to show part of a background image behind the div. Because the opacity is at 60%, the text in that div appears as grey.

Is there anyway to override this level and make the text appear black?

Any advice appreciated.

Thanks.

解决方案

Set the opacity on the background rather than the element.

background-color: rgba(255,0,0,0.6);

A while ago I wrote about how to achieve this in a backwards compatible way.

这篇关于CSS - 不透明文本在低不透明度div?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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