如何使输入字段不透明度不影响其中的文本颜色? [英] How do you make an input field opacity not effect the text color inside it?

查看:81
本文介绍了如何使输入字段不透明度不影响其中的文本颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个深色/黑色背景图像和一个白色输入字段.我给输入字段的不透明度为50%,我希望文本/值是纯白色(#fff).但是,当我应用不透明度时,它将同时影响输入元素的背景和文本.如何仅更改输入字段的背景?

I have a dark/black background image and a white input field. I gave the input field an opacity of 50% and I want the text/value to be solid white(#fff). BUT when I apply the opacity it effects both the background of the input element and the text. How to I only change the background of the input field?

推荐答案

为此,您可以使用background-color: rgba(0, 0, 0, 0.5).前三个数字是rgb(红色,绿色,蓝色)格式的背景色,第四个数字是从0到1的不透明度级别.

For that you could use background-color: rgba(0, 0, 0, 0.5). The first three numbers are the background color in rgb (red, green, blue) format and the fourth number is the opacity level on a scale from 0 to 1.

这篇关于如何使输入字段不透明度不影响其中的文本颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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