本文介绍了HTML中的通用标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用HTML/CSS/Javascript创建一个通用的页眉(和页脚),以便如果我将其更新为一页,则其余部分会自动更新.我还希望能够选择哪个链接显示在其上的活动类.另外,我正在使用引导程序.这是我需要满足的一些条件:
I want to create a universal header (and footer) using HTML/CSS/Javascript so that if I update it to one page, it automatically updates on the rest. I also want to be able to choose which link is showing up with the active class on it. Also, I am using bootstrap. Here are some criteria I need to meet:
- 没有PHP
- 没有服务器端(必须在github页面上工作)
先谢谢您
阿尔伯特
推荐答案
您可以使用 jQuery 来.load
HTML 文件:
<div id="header"></div>
jQuery
$('#header').load('static.html');
或者,您可以使用iframe
加载静态标头.有关可用技术的更多信息,请参见此答案.
Alternatively, you could use iframe
to load your static header. See this answer for more information regarding the available techniques.
这篇关于HTML中的通用标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!