css - 如何在iframe中定位图像

标签 css iframe

如何使用 CSS 定位 iframe 内的图像?

这行不通

iframe img {
    height: auto;
    width: 100%;
}

enter image description here

最佳答案

为此尝试 jquery

$('iframe').contents().find('img').css({width: '100%', 'height': '100%'});

如果 iframe 在页面加载后稍后加载,则将其包装在 jQuery 加载回调中

$('iframe').load(function() {
    $(this).contents().find('img').css({width: '100%', 'height': '100%'});
})

关于css - 如何在iframe中定位图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37026819/

相关文章:

html - 行中包含列

html - 从内部更改 iFrame 属性和 CSS

ipad - 为什么 iframe div 在 iPad 上不滚动?

iphone 不允许用户缩放或滚动此网站

css - 垂直边距不重叠

html - 调整 html 网站以适应不同的屏幕分辨率

android - 带有 IFRAME android 的 WebView

javascript - 用 Div 替换 iframe((多个)下拉列表相关)

angular - 如何在iframe中的Kibana仪表板中绕过登录

html - 使文本出现在按钮中间