【问题标题】:How to add a html file into another html file (with example)如何将 html 文件添加到另一个 html 文件中(示例)
【发布时间】:2017-01-25 08:46:33
【问题描述】:

我问了before 的问题,没有得到帮助。又来了—— 我有一个 html 文件 - "main.html" 和另一个 html 文件 "content.html",其中内容是绝对的 &

contentWidth = window.innerWidth || root.clientWidth || body.clientWidth;
contentHeight = window.innerHeight || root.clientHeight || body.clientHeight;
  • 我不知道 main 的高度和宽度。

当我通过将此代码添加到 main.html 正文中添加内容时 -

<object type="text/html" 
        data="http://pechasgamestudios.com/richmedia/aci/"
        width="100%"
        height="560"
        style="overflow:auto;border:0px ridge blue; position: absolute; top: 0px; left: 0px;">
</object>

main.html 变成了这个 - http://pechasgamestudios.com/richmedia/acitest/ 它不能很好地工作。应该没有滚动条。怎么办?

【问题讨论】:

  • http://pechasgamestudios.com/richmedia/aci/如何生成html?问题就在那里。发布该代码
  • 工作完成。谢了哥们。从您之前删除的帖子中:内容:样式:宽度:100%;高度:100%;以前是“自动”。
  • 所以我确实取消了删除,你可以接受它

标签: javascript html oop object


【解决方案1】:

我认为问题源于http://pechasgamestudios.com/richmedia/aci/ 将以下样式标签添加到画布

style="width: 100%; height: 100%;";

【讨论】:

  • 工作完成。谢了哥们。以前是 - style="width: auto; height: auto;"
  • @FahadZaman:要将答案标记为已接受,请单击答案旁边的复选标记以将其从灰色切换为已填充。See Help Center
【解决方案2】:

根据 W3School 添加 HTML 文件,您可以使用 w3-include-html 属性。 演示看here。

【讨论】:

  • 这样做后,“main.html”上没有“content.html”的迹象我希望内容绝对超过主要内容,内容宽度=主要宽度。
猜你喜欢
  • 1970-01-01
  • 2011-09-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-08-18
  • 2011-11-24
  • 2017-04-06
相关资源
最近更新 更多