如何使用HTML创建母版页?

时间:2022-11-13 01:22:19

I have a website which I want to have a consistent style (a header and a side menu) in every page.

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

I want to create something similar to a master page for it. I don't want to use frames.

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

How could I achieve this using HTML, CSS, JavaScript and jQuery?

我怎么能用HTML,CSS,JavaScript和jQuery实现这个目标?

1 个解决方案

#1


23  

you can use jQuery Load function to include header or menu html page, for example, to include a common header html file,

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

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

#1


23  

you can use jQuery Load function to include header or menu html page, for example, to include a common header html file,

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

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