java - "full-page"小程序的 HTML 代码(无 javascript)?

标签 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" 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;
}

关于java - "full-page"小程序的 HTML 代码(无 javascript)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9985755/

相关文章:

html - 下拉列表边框

java - 如何在 Spring MVC 的 Controller 中使用 DAO?

java - JSF2 : commandLink without javascript

html - CSS 中的图像方向和布局

html - colspan 宽度问题

asp.net - 我们可以声明性地设置 Web 控件的 Style 属性吗?

java - 如何定义Java类的设计规则?

java - Liquibase liquibase-maven-plugin 创建表,但在集成测试中找不到表 : org. hibernate.HibernateException

javascript - 如何阻止 dataURL 成为实际的 url?

php - 使用 css 和空白行设置 php echo 样式