【发布时间】:2014-10-24 22:41:18
【问题描述】:
我是 CSS 新手,因此这个问题的解决方案可能很简单。我搜索了网络但没有找到解决方案;尽管我认为这个问题相当普遍。
我将 iframe 嵌入到 html 文档中,如下所示:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="main.css" />
</head>
<body>
<p>Test</p>
<iframe class=result-frame src="/media/converted/1409487227933_testpage.html></iframe>
</body>
</html>
现在我想让 iframe 尽可能大以包含其所有内容。为此,我将宽度设置为 100%:
.result-frame {
width: 100%;
}
但我不知道如何将 iframe 的高度调整为足够大以适应其内容,从而不显示滚动条。
我已经看到了一些使用 javascript 的解决方案,但我只想坚持使用 CSS/HTML。这甚至可能吗?
托比亚斯
【问题讨论】:
-
不,只有 HTML 和 CSS 是不可能的。