包含其他HTML文件的文件 [英] Including a file with other HTML file

查看:106
本文介绍了包含其他HTML文件的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在单个html文件中包含菜单和页脚,然后我想将其导入其他html文件以减少开销。我有很多页面的网站..所以我想要的东西,我在一个文件上创建菜单链接,其余的文件将使用相同的链接,因为他们的方式...我不想写在每个文件的链接。只是想写一次并用它alwaus ...



我尝试过:



没有想法已经使用iframe但想要一个完美的方法来做基本的html文件谢谢你请帮助

i want to include menu as well as footer in single html file where then i want to import it to other html files to reduce the overheads. i have website with vast no of pages .. so i want something that i create menu links on one file and rest of file will use the same links as much as they way...i dont want to write in every file the link. just want to write it once and usee it alwaus ...

What I have tried:

NO idea already used iframe but want a flawless method to do soin basic html files thank you please help

推荐答案

最多HTML 4有不支持包含其他HTML文件。



使用HTML 5,

Up to HTML 4 there was no support of including other HTML files.

With HTML 5,
<link rel="import" href="[uri]">

。请参阅 HTML Imports [ ^ ]和 HTML导入: #include for the web - HTML5 Rocks [ ^ ]。



当仍然使用HTML 4时,有各种方法,如使用脚本,iframe和服务器端包含。例如参见

包含另一个HTML文件HTML文件 - 堆栈溢出 [ ^ ]

has been added. See HTML Imports[^] and HTML Imports: #include for the web - HTML5 Rocks[^] .

When still using HTML 4 there are various methods like using scripts, iframes, and server side includes. See for example
Include another HTML file in a HTML file - Stack Overflow[^]


这篇关于包含其他HTML文件的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆