Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 透明div内的非透明iframe_Html_Css_Iframe - Fatal编程技术网

Html 透明div内的非透明iframe

Html 透明div内的非透明iframe,html,css,iframe,Html,Css,Iframe,我有一个不透明度设置为0.8的div,在该div内有一个iframe。 我不希望iframe是透明的(即不透明度1.0) 标记: <div id="container"> some text and images <iframe width="500" height="370" src="http://www.youtube.com/embed/'+videoId+'" frameborder="0" allowfullscreen></iframe>

我有一个不透明度设置为0.8的div,在该div内有一个iframe。 我不希望iframe是透明的(即不透明度1.0)

标记:

 <div id="container">
  some text and images
  <iframe width="500" height="370" src="http://www.youtube.com/embed/'+videoId+'" frameborder="0" allowfullscreen></iframe>
</div>
我尝试将不透明度重置为1.0,但不起作用!,我将感谢任何帮助


此外,这是设置不透明度的最佳方法(跨浏览器兼容性方面)

这是不可能的;设置不透明度时,它将应用于所有子元素。通过将背景色设置为
rgba(0,0,0,0.8)
,或者类似的方式,您可能可以实现您想要的效果


编辑:抱歉,我误读了,错过了您已经有了
不透明度:0.8
,以及MS特定的代码。

解决方案是在您的选择器中更加特定。将div保留为默认不透明度(1),而是更具体地针对div中应具有不透明度的项目。就像:

#container p, #container img {
   opacity: 0.8;
   filter:progid:DXImageTransform.Microsoft.Alpha(opacity=80);
}

可能重复的感谢,这可以做的把戏,但我感兴趣的是使div背景透明!使用{background color:rgba(254252,0.9)}正是在。。。
#container p, #container img {
   opacity: 0.8;
   filter:progid:DXImageTransform.Microsoft.Alpha(opacity=80);
}