如何为iframe设置自定义视口?

meh*_*mpt 3 html css iframe

好的.实际上,也许标题毫无意义.

请阅读:

我想创建一个自定义宽度的iframe.好的.请尝试理解.

我不希望iframe响应(嵌入在iframe中的网站是响应式的),我希望它看起来像缩小的图片.

如果你愿意,我可以给你一些例子.知道怎么做吗?

小智 10

您可以使用css转换缩放iframe.例如,如果您想使iframe中的页面以半角显示..

iframe {
  transform: scale(0.5, 0.5);
  height: 1000px;
  width: 1000px;
}

<iframe src='http://www.google.com'></iframe>
Run Code Online (Sandbox Code Playgroud)

这应该显示缩小到500x500 iframe的页面的1000x1000视口.