如何应用CSS到iframe内容? [英] How to apply css to iframe content?

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

问题描述

这个网站上有几个主题讨论这个主题,但没有一个提供的解决方案对我有用。



任何人都可以提供一个解决方案,你试过,

解决方案



<你可以使用jQuery的 .content()函数来访问它。

  $('yourIframe')。contents()。find('#yourItemYouWantToChange')。css({
opacity:0,
color:'purple'
});



示例



将css应用于通常位于屏幕左上角的jQuery标志。注意,它必须是相同的域/端口等,所以这就是为什么我的示例在iframe中使用jsfiddle。

http://jsfiddle.net/pPqGe/


There are a few threads on this site discussing this topic, but none of the offered solutions worked for me.

Can anyone please provide a solution that you tried and you know that it works?

Thanks in advance.

解决方案

You can use jQuery's .content() function to access it.

$('yourIframe').contents().find('#yourItemYouWantToChange').css({
    opacity: 0,
    color: 'purple'
});

Example

Here's an example showing me applying css to the jQuery logo typically found in the top left of the screen. Mind you, it has to be same domain/ports etc, so that's why my example features jsfiddle in the iframe.
http://jsfiddle.net/pPqGe/

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

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