避免重复的HTML [英] Avoid repeated HTML

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

问题描述

我有两个HTML页面。
我想避免重复标记,如头部,导航等。
例如,这里是一个页面:

I have two HTML pages. I would like to avoid repeating markup, like head, navigation, etc. For example, here is one page:

<head><title>Los Pollos Hermanos</title></head>
<body>About Us</body>

以下是另一个:

And here is another:

<head><title>Los Pollos Hermanos</title></head>
<body>Contacts</body>

我不喜欢重复这些事情,所以我想将head + title部分移出,到一些单独的文件,然后从其他页面调用这个单独的文件。这是正确的方法吗?这种做法是什么?

I don't like to repeat things, so, I want to move the head+title part out, to some separate file, and then call this separate file from other pages. Is this the correct way? What is the practice?

推荐答案

这取决于您使用的语言。如果您想严格使用HTML,请查看您的服务器是否支持shtml。如果是这样,您可以使用includes将文件读入另一个文件。

It depends on the language you are using. If you want to do this strictly in HTML, see if your server supports shtml. If it does, you can use includes to read the file into another file.

<!--#include FILE="filename.html"--> 

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

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