【问题标题】:How to change header iframe height to increased value?如何将标题 iframe 高度更改为增加值?
【发布时间】:2019-02-09 20:27:05
【问题描述】:

我正在尝试为标题增加此 iframe 的高度,以便不显示滚动条。我在这里错过了什么?

The header.

来自 index.html:

<header>
        <iframe src="header.html" frameborder="0" width="100%" height="270"></iframe>
    </header>

来自 header.html:

<header>
<div style="display: flex; justify-content: center;">
    <a href="index.html" target="_parent"><img src="images/$RK6ZV6D.JPG" alt="logo" width="60%"></a></div>

来自 main.css:

iframe {
    overflow: auto;
    height: auto;
}
header {
    background-color: #fff;
}

【问题讨论】:

  • 你到底想在这里实现什么?
  • 我试图增加 iframe 的高度,以便显示图像的底部。
  • 好的。您将要从 iframe css 中删除 height: auto,因为您已经在 iframe 属性上定义了 height="270"
  • 是的!我得到了它并从 main.css 中删除了 iframe {} 并在 index.html 中使用了 &lt;header&gt; &lt;iframe src="header.html" frameborder="0" width="100%" height="240"&gt;&lt;/iframe&gt; &lt;/header&gt; 并为我解决了它。

标签: html css iframe header height


【解决方案1】:

尝试在页眉上使用边距。它有助于让其他物体靠近或远离其他物体:

p {
    margin-top: 100px;
    margin-bottom: 100px;
    margin-right: 150px;
    margin-left: 80px;
}

更多信息请见marginsiframe

【讨论】:

  • 啊!没关系!事实证明,我的问题是,由于某种原因,HTML 无法识别 iframe 高度,但不知何故让它正常工作......然后将标题下方的边距设置为略低于 0% 以掩盖白色空间有点。无论如何,谢谢!
猜你喜欢
  • 2010-12-24
  • 1970-01-01
  • 1970-01-01
  • 2016-11-14
  • 1970-01-01
  • 2012-07-26
  • 2022-06-21
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多