iframe 中的样式内容 [英] style content within an iframe

查看:29
本文介绍了iframe 中的样式内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在 iframe 中设置样式.

<头><link href="url/to/my/custom.css"></link><身体>......<iframe class="webform-frame">...</iframe>

在我的 custom.css 中,我已经尝试使用 .webform-frame h5 { color: #f00;} 但它不起作用.

iframe 是由一些 JavaScript 生成的(我无法访问它).

知道如何在 iframe 中设置样式吗?

解决方案

如果你想定位 iframe,即边框、边框颜色、内边距或边距,那么使用它将会定位你的 iframe代码>iframe:

iframe.webform-frame {/* 样式 */}

如果您尝试定位在 iframe 中加载的标记,那是不可能的.

<块引用>

注意:您可以控制一些事情,例如使框架背景透明等...

<小时><块引用>

想在此处添加 seamless 属性说明,正如 Sebastian 所说,但是支持很差,你也许应该忽略这样做..也不要编辑未经页面所有者事先许可的任何 iframe 页面

I have to style something within an iframe.

<html>
 <head>
   <link href="url/to/my/custom.css"></link>
 </head>
 <body>
    ......
    <iframe class="webform-frame">...</iframe>
 </body>
</html>

In my custom.css I already tried to use .webform-frame h5 { color: #f00; } but it doesn't work.

The iframe is generated by some JavaScript (I have no access to it).

Any idea how I could style that stuff within that iframe?

解决方案

If you want to target the iframe i.e the border, border color, padding, or margin, then using this will target your iframe:

iframe.webform-frame {
   /* Styles */
}

If you are trying to target the markup which is loaded inside the iframe than that's not possible.

Note: You can control a few things like making the frame background transparent etc...


Edit: Would like to add seamless attribute explanation here, as Sebastian told, but the support is poor, you should perhaps ignore doing so.. Also do not edit any iframed pages without prior permission of the page owner

这篇关于iframe 中的样式内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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