【发布时间】:2021-04-29 12:46:13
【问题描述】:
我用 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 框架添加或删除样式。
【问题讨论】:
-
@ShahryarMohajer 是的,我不太喜欢它,但这里唯一的解决方案是使用 javascript
标签: html css iframe vaadin vaadin7