【发布时间】:2012-04-16 15:55:58
【问题描述】:
大家下午好,
我有一个希望嵌入网站的 Java 小程序。我要求小程序全尺寸,即占据网页的 100% 宽度和 100% 高度。
应该没有滚动条。
这是我目前拥有的代码:
<!doctype html>
<html>
<body style="background:red; width:100%; height:100%; padding:0; margin:0; border:0;">
<applet code="HelloWorld.class" style="padding:0; margin:0; border:0; width:100%; height:100%;">
Your browser does not support the <code>applet</code> tag.
</applet>
<!-- the applet should cover the entire page, so even though the body is red, it should be covered by the applet -->
</body>
</html>
由于某种原因,它不适用于 FireFox 和 IE。在 Chrome 中,小程序看起来比页面本身高,因此会显示一个垂直滚动条。我们如何让小程序完全填充网页的大小,既不显示任何水平滚动条也不显示任何垂直滚动条?
PS:如果可能,在禁用 JavaScript 的浏览器上运行的解决方案会很酷。
【问题讨论】: