防止iFrame使用父CSS [英] Prevent iFrame from taking parent CSS

查看:331
本文介绍了防止iFrame使用父CSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何防止iFrame对象占据主页的CSS属性. (或者我认为这就是它的作用)

How is it possible to prevent a iFrame object from taking on css properties from the main page. (or I think that is what it is doing)

特别是:

我正在我的主类中创建一个iframe对象,并且试图在显示iFrame时更改主页的不透明度,但由于某种原因,它也会更改iFrame的不透明度.我试图放入代码,但是看起来很丑...

I'm creating an iframe object in my main class and I'm trying to change the opacity of the main page when the iFrame is displayed but for some reason it changes the opacity of the iFrame too. I tried to put the code but it looks to ugly...

基本上,我试图通过类似Facebook(或其他网站)的方式来查看图像.背景变暗(淡),并弹出一个页面,您可以在其中浏览.

Basicly im trying to do something like the Facebook (or may other websites) way of looking at images. The background turns dark(ish) and a page pop ups and you can navigate through that.

推荐答案

如何防止iFrame对象占据主页的CSS属性.

How is it possible to prevent a iFrame object from taking on css properties from the main page.

什么都不做. iframe包含独立的文档,CSS不会级联到其中.

Do nothing. iframes contain independent documents, CSS will not cascade into them.

显示iFrame时,我试图更改主页的不透明度,但由于某些原因,它也更改了iFrame的不透明度

I'm trying to change the opacity of the main page when the iFrame is displayed but for some reason it changes the opacity of the iFrame too

opacity更改其应用到的元素的渲染内容,而不是该元素的每个后代.

opacity changes the rendered content of the element to which it applies, not each individual descendent of that element.

不要将iframe放在要设置opacity的元素内.您可能必须使用绝对定位来获取所需的布局.

Don't put the iframe inside the element you are setting the opacity of. You'll probably have to use absolute positioning to get the layout you want.

这篇关于防止iFrame使用父CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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