宝塔服务器面板,一键全能部署及管理,送你10850元礼包,点我领取

iframe设置height为100%无效,实际是因为父空间高度没有设置的问题。

代码如下

<body>
    <iframe id="content" src="main.do" name="content" frameborder="0" scrolling="no" height="100%" width="100%"></iframe>
</body>

追加css,设置html跟body高度为100%,即可全屏显示iframe

html,body
{
    margin: 0;
    padding: 0;
    border: 0;
    overflow: hidden;
    height: 100%;
}

ps:如果设置了还是无效,请注意css冲突,看看是不是其他的css设置了height:auto !important;