Html代码的一个";整版;小程序(没有javascript)?
大家下午好 我有一个Java小程序,我希望嵌入到网站上。我要求小程序是全尺寸的,即它占据网页的100%宽度和100%高度 应该没有滚动条 这是我目前拥有的代码:Html代码的一个";整版;小程序(没有javascript)?,java,html,css,applet,Java,Html,Css,Applet,大家下午好 我有一个Java小程序,我希望嵌入到网站上。我要求小程序是全尺寸的,即它占据网页的100%宽度和100%高度 应该没有滚动条 这是我目前拥有的代码: <!doctype html> <html> <body style="background:red; width:100%; height:100%; padding:0; margin:0; border:0;"> <applet code="HelloWorld.class"
<!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的浏览器上工作的解决方案会很酷。使用绝对位置。不要指定高度或宽度
applet {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
}
另一种方式
applet {
position: absolute;
top: 0;
left: 0;
width:100%;
height:100%;
}
但关键是我希望小程序是全宽和全高的。@pacerier-这就是为什么要指定底部和右侧。它可以按照你想要的方式工作。你可能想在很多浏览器上测试它。上次我检查它时,有很多关于使用百分比值调整小程序大小的方法。使用JS(部署和)调整小程序的大小更安全,JS擅长这种类型的东西。