html - 如何更改 iframe 内图像的样式
问题描述
我用 Vaadin 7 生成了一个 iframe,结果是:
<div class="zoom-to-fit" style="width: 1200px; height: 900px;">
<iframe src="http://localhost:8090/image.png" frameborder="0" width="100%" height="100%">
</iframe>
</div>
我可以向 iframe 添加样式类zoom-to-fit
,但 iframe 包装在 div 中。
我正在尝试将图像拉伸到 iframe,但它不起作用。
我尝试了以下方法:
.zoom-to-fit {
width: 100%;
height: 100%;
}
.zoom-to-fit {
background-size: 100% 100%;
}
.zoom-to-fit > html > body > img {
width: 100%;
height: 100%;
}
但它们不起作用。
我添加了最后一个,因为开发人员工具中的 html 代码如下所示:
我想我无法修改 iframe 内的任何样式......但我怎么能调整图像的大小?
我知道如果我转到图像并添加第一个样式(宽度和高度为 100% 有效),但我只能使用我正在使用的 Vaadin 框架添加或删除样式。
解决方案
我从可能有帮助的论坛帖子中看到了这一点: https ://vaadin.com/forum/thread/393458/embedded-component-image-and-setwidth-resizing-both-component-and-image
另一个SO问题也有这个: Resizing Vaadin Image
推荐阅读
- go - Go YouTube API:用什么代替 liveBroadcasts.control 方法来显示石板?
- instruments - 如何在 Xcode 13 / iOS15 中测量能源使用情况?
- reactjs - 如何防止在错误按钮上提交表单并且只在右键上工作
- spring-boot - @cachePut 用于 Spring Boot 中对象列表中的数据更新
- c++ - 无法使用 lldbbridge.py 来检查 Qt 对象,因为“包装器前缀”中的错误
- r - 地理编码:找到两组位置之间距离的有效方法
- javascript - Var 变量是否会从 IIFE 中取出?
- node.js - 使用 Mongoose .find() 在 EJS 模板中渲染数据
- python - 在另一个目录中导入脚本时出现导入错误
- excel - 使用 vba 根据下拉菜单创建唯一表