html - 缩放 iframe 时 Chrome 会忽略 CSS

标签 html css google-chrome

运行时的代码在 Firefox 中运行良好,但在 Chrome 中运行时 - 它根本不起作用 - 来自 iframe 的#agree 元素无法隐藏。如何为 Chrome 修复它?

这是我的简化代码:

<iframe src="blank.htm"></iframe>

<button id="btn">Toggle</button>

<script>
frame = null;

$('iframe').load(function()
{
    frame = $('iframe').contents();
});

$('#btn').click(function()
{
    var div = frame.find('#agree');
    div.toggle();
});
</script>

<style>
iframe
{
    width: 600px;
    height: 1200px;
    transform: scale(0.5);
}
</style>

在这里你可以测试它: http://nitton.pl/chrome/

最佳答案

chrome 和 firefox 的区别在于,chrome 使用 -webkit-transform: 浏览器引擎,而 firefox 没有。

尝试使用 webkit 使其在 chrome 浏览器上以最佳方式运行。

关于html - 缩放 iframe 时 Chrome 会忽略 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28478099/

相关文章:

javascript - iOS Chrome - 如何计算窗口高度减去地址栏高度

javascript - 是否可以更改点击元素?

javascript - 带有堆叠列的 Bootstrap 网格

css - 如何覆盖内联样式

html - 三列布局中的动态宽度第三列

css - Kendo 网格 - 悬停颜色变化不适用于谷歌浏览器

HTML div 不显示浏览器打印

html - CSS 背景图片不显示

javascript - 在鼠标悬停时增加标题文本的大小

html - 极其简单的 flexbox 布局,溢出 : hidden -- vertical mis-alignment in Firefox