重置子元素的不透明度 - Maple Browser(Samsung TV App) [英] Resetting the opacity of a child element - Maple Browser (Samsung TV App)

查看:181
本文介绍了重置子元素的不透明度 - Maple Browser(Samsung TV App)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,创建一个透明元素有一个子元素。
使用这个代码子元素从父元素获得不透明度值。

I have an issue with creating a transparent element which has a child element. Using this code the child element gets the opacity value from the parent element.

我需要重置/设置子元素的不透明度为任意值。
参考浏览器 Maple浏览器(适用于三星电视应用程序)

I need to reset/set the child's element opacity to an arbitrary value. Browser of reference is Maple Browser (for a Samsung TV Application).

 .video-caption {
        position: absolute;
        top:50px;
        width: 180px;
        height: 55px;
        background-color: #000;
        -khtml-opacity:.40; 
        -moz-opacity:.40; 
        -ms-filter:"alpha(opacity=40)";
        filter:alpha(opacity=40);
        filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0.4); /*just for testing*/
        opacity:.40; 
    }
    .video-caption > p {
        color: #fff !important;
        font-size: 18px;
        -khtml-opacity:1; 
        -moz-opacity:1; 
        -ms-filter:"alpha(opacity=100)";
        filter:alpha(opacity=100);
        filter: progid:DXImageTransform.Microsoft.Alpha(opacity=1);
        opacity:1; 
    }

EDIT MARKUP

EDIT MARKUP

<div> <img id="videothb-1" src="https://xxxxx/splash.jpg"> <div class="video-caption"> <p>Description here</p> </div> </div>


推荐答案

您可能遇到的问题选择器)是不透明度影响父母的所有子元素:

The problem you probably have (based on looking at your selectors) is that opacity affects all child elements of a parent:

div
{
    background: #000;
    opacity: .4;
    padding: 20px;
}

p
{
    background: #f00;
    opacity: 1;
}​

http://jsfiddle.net/Kyle_Sevenoaks/TK8Lq/

但有一个解决方案!使用rgba背景值,您可以在任何地方拥有透明度:)

But there is a solution! Use rgba background values and you can have transparency wherever you want :)

div
{
    background: rgba(0, 0, 0, 0.4);
    /*opacity: .4;*/
    padding: 20px;
}

p
{
    background: rgba(255, 0, 0, 1);
    /*opacity: 1;*/
}​

http://jsfiddle.net/Kyle_Sevenoaks/TK8Lq/1/

对于文本,您只需使用相同的rgba代码,但设置为CSS的颜色属性:

For text, you can just use the same rgba code, but set to the color property of CSS:

color: rgba(255, 255, 255, 1);

但是你必须使用rgba来为这个工作,你必须删除所有父元素。

But you must use rgba on everything for this to work, you have to remove the opacity for all parent elements.

http:// jsfiddle。 net / Kyle_Sevenoaks / TK8Lq / 2 /

这篇关于重置子元素的不透明度 - Maple Browser(Samsung TV App)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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