【问题标题】:CSS: iframe not displaying 100% height...more like 100px heightCSS:iframe 不显示 100% 高度...更像 100px 高度
【发布时间】:2015-06-20 22:01:45
【问题描述】:

此页面 (http://purcraft.com/madeinla/) 存在问题,我正在尝试使用 iframe 元素显示此页面的内容:(http://purcraft.com/madeinla/home2_height.html)。

宽度不错,但高度呢?似乎更像是 100px 而不是我想要的 100%。为什么是这样?这是我的代码。这很简单。

<iframe style="overflow:hidden;height:100%;width:100%" height="100%" width="100%" src="http://purcraft.com/madeinla/home2_height.html"></iframe>

【问题讨论】:

  • 尝试对父 div 使用 px 中的值,然后对 iframe 使用 % 值
  • 正如@K.B.M 所说,iframe 高度百分比取决于父级。你的父母就是身体,它只有它需要的高度。将其包裹在一个 div 中,并在 div 上设置一个以 px 为单位的高度。注意:iframe % 高度不是内容的 100%。

标签: css iframe height width overflow


【解决方案1】:

试试这样:

position: absolute; and border:none;IFRAME 一起提供给您的height:100% 以获得预期结果。

HTML:

<iframe width="100%" height="100%" src="http://purcraft.com/madeinla/home2_height.html" style="position: absolute; height: 100%; border: none"></iframe>

【讨论】:

  • 啊,我只需要声明定位!那行得通。非常感谢。
猜你喜欢
  • 1970-01-01
  • 2014-05-20
  • 1970-01-01
  • 2013-03-03
  • 2016-02-17
  • 2012-12-17
  • 1970-01-01
  • 2015-03-15
相关资源
最近更新 更多