<分区>
我无法让 CSS 生成的内容用于 iframe
元素:
iframe::after {content: 'example';}
iframe::before {content: 'example';}
有没有人有实际有效的解决方案?提前致谢。
<分区>
我无法让 CSS 生成的内容用于 iframe
元素:
iframe::after {content: 'example';}
iframe::before {content: 'example';}
有没有人有实际有效的解决方案?提前致谢。
最佳答案
您可以使用 jQuery 的 .content()
函数来访问它。
$('yourIframe').contents().find('#yourItemYouWantToChange').css({
opacity: 0,
color: 'purple'
});
这是一个示例,展示了我将 css 应用于通常位于屏幕左上角的 jQuery Logo 。请注意,它必须是相同的域/端口等,所以这就是我的示例在 iframe 中使用 jsfiddle 的原因。
http://jsfiddle.net/pPqGe/
关于css - 如何将CSS应用于iframe内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3714880/