CSS选择选项为透明背景 [英] CSS for Select Option to be transparent background

查看:155
本文介绍了CSS选择选项为透明背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网页中有背景图片。之后,有一个组合框用于过滤一些内容。我想创建这个选择 - 选项背景是透明的。我已经阅读了许多结果在google使用选择选项在CSS,但它没有工作。我在这里创建了一个小提琴: http://jsfiddle.net/25CQE/5 例如和如你所见,选项背景不透明。那么,任何想法如何解决呢?

I have a web page that have background-image in it. After that, there's a combo box for filtering some content. I want to create this select - option background being transparent. I've read many result at google to use select option at CSS, but it didn't work. I've create a fiddle in here : http://jsfiddle.net/25CQE/5 For example and as You can see, the option background is not transparent. So, any idea how to solve that? Or it cannot be done by CSS?

推荐答案

如果您要使其完全透明,请使用

If you want to make it fully transparent, than use

select {
    border: 1px solid #fff;
    background-color: transparent;
}

演示

如果您希望具有半透明背景颜色,可以使用 rgba()其中 a 代表

If you are looking to have semi-transparent background color, than you can use rgba() where a stands for alpha

select {
    border: 1px solid #fff;
    background-color: rgba(255,255,255,.5);
    padding: 5px;
}

演示2

这篇关于CSS选择选项为透明背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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