怎么让iframe的高度和宽度可以100%

charlesxu charlesxu 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
html的代码如下,其中有2个div,一个宽度是200px。另一个div里有个Iframe,不论我怎么设置样式都不能让这个Iframe的宽度自动达到100%,只能设置个定值。现在默认的Iframe宽度和高度都很小,大概只有200px。


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title></title>
<style type="text/css">
html, body
{
width: 100%;
height: 100%;
}
</style>
</head>

<body>
<div class="dtree" style="position: absolute; left: 0px; top: 0px; width: 200px; height: 100%; padding: 5px; overflow: auto;">

</div>

<div style="position: absolute; left: 205px; top: 10px;" width="100%" height="100%">
<Iframe name="tt" style="height=100%; width=80%" src="" marginwidth="1" marginheight="1" scrolling="yes" frameborder="10"></Iframe>
</div>
</body>
</html>

...全文

相关推荐

评论 3
收藏 已收藏
分享
返回顶部
charlesxu
CSS 61,116 成员 60,701 内容