【问题标题】:Display full website within Iframe of certain size在一定大小的 iframe 中显示完整的网站
【发布时间】:2021-11-11 04:13:36
【问题描述】:

第一次在这里发布海报。

简而言之,我试图在 iframe 中显示一个网站。我希望 iframe 显示网站的全屏。我设法做到这一点的唯一方法是调整容器的大小。

我可以简单地缩小 iframe 吗?

希望我已经足够清楚地解释了自己。

.gridgames {
  height: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  grid-gap: 10px;
  margin: 2rem;
}

.game {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 20rem;
  margin: auto;
  background-color: green;
  transition: 150ms;
}

.game:hover {
  transform: scale(1.1);
}

iframe {
  width: 100%;
  height: 100%;
  border: none;
  overflow: hidden;
}
 <section class="gridgames">
      <div class="game"><iframe src="https://barneslow.com/"></iframe>​</div>
      <div class="game">Sample Game</div>
      <div class="game">Sample Game</div>
      <div class="game">Sample Game</div>
      <div class="game">Sample Game</div>
      <div class="game">Sample Game</div>
    </section>

我附上了一些代码来概述我的问题。

是否可以在 iframe 上“缩小”?

【问题讨论】:

    标签: html css iframe iframe-resizer


    【解决方案1】:

    使用这个:

    transform:scale(0.5); //50% zoom
    

    这只是根据比例值缩小整个 iFrame。

    您可能还需要更改宽度和高度以及边距和位置。

    【讨论】:

    • 我试过变换。我似乎只改变了 iframe 框的大小。不是其内容的缩放程度。
    • 您应该重新开始考虑转换。这就是我所做的: .gridgames { height: auto;显示:网格;网格模板列:重复(自动调整,最小最大(350px,1fr));网格间隙:10px;保证金:2rem; } .game { 过渡:150 毫秒; } .game:hover { 变换:比例(1.1); }
    • 这对您有帮助吗?
    猜你喜欢
    • 1970-01-01
    • 2011-12-22
    • 2017-11-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-30
    • 2011-10-15
    • 1970-01-01
    相关资源
    最近更新 更多