javascript - 如何使用 HTML 创建母版页?

标签 javascript jquery html css

<分区>

我有一个网站,我希望每个页面都具有一致的样式(标题和侧面菜单)。

我想为它创建类似于母版页的东西。我不想使用框架。

我如何使用 HTML、CSS、JavaScript 和 jQuery 实现这一点?

最佳答案

您可以使用 jQuery Load 函数来包含标题或菜单 html 页面,例如,包含一个常见的标题 html 文件,

    <div id="new-header">
        <script>
            $("#new-header").load("header.html");
        </script>
    </div>

关于javascript - 如何使用 HTML 创建母版页?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18464326/

相关文章:

javascript - 将变量从 html 传递到 javascript 再到 php

javascript - 图像作为基于 javascript 的粒子网络效果的节点?

javascript - 打开多个模态 Materialise CSS

javascript - 当特定的 div 可见时改变颜色

javascript - 为什么 margin 仅在 .info 处于事件状态时适用

javascript - 如何让jquery插件使用jquery.live?

css - 在 DIV 中对齐 'radio' 和 'comment'

javascript - 将谷歌地图添加到我的网站

javascript - ReactJS 状态没有改变

javascript - React : Changing State in functional component also Change functional component's props value, 及其父类状态