网页的常见HTML部分 [英] common HTML parts of webpages

查看:91
本文介绍了网页的常见HTML部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们。



我正在用asp.net设计一个网站。



In我的网站我有很多网页。



所有页面都有相同的标题,相同的菜单,相同的菜单栏和其他页面。



请注意,每个页面中的主要数据与其他页面不同。



为此,我复制每个页面的常见HTML部分页面并将其粘贴到新页面!



这些常见部件:



< div id = headerDIVstyle = ...>

...

< / div>



我的问题是如何在每个页面中输入这些常用部分并在所有页面中使用它?



如果不这样做,我应该在我想改变时更改所有页面例如标题中的小东西!



我认为一种方法是将常见的HTML部分保存在一个.html文件中,并像这样使用它: />
<! - #include文件=" header.html" - >



但是,它是最好的解决方案吗?!



是不是导致网站加载不好,特别是对于低速互联网用户!?



还有更好的解决方案吗?



提前致谢。

Hi friends.

I’m designing a website with asp.net.

In my website I have many web pages.

All pages have a same header, and same menu, and same right menu bar, and others.

Note that the main data in each page is different from others.

For this, I copy the common HTML part of each page and paste it in new page!

Common parts like these:

<div id="headerDIV" style=… >

</div>

My problem is that how can I type these common parts of each page just one time and use it in all pages?

Without doing like this, I should change all pages when I wanna change a little thing in the header for example!

I think one way is to save the common HTML part in one .html file, and use it like this:
<!--#include file="header.html"-->

But, is it a best solution ?!

Isn’t it cause bad loading of the website especially for users with low speed Internet !?

Is there any better solution?

Thanks in advance.

推荐答案

您应该只使用母版页。

见这里 [ ^ ]



它允许您在任何页面上拥有所需的重复内容,实际代码仅存在于一个位置。您还可以逐页更改部分。你可以随心所欲地看它。
You should just use a master page.
See here[^]

It allows you to have repeating content you want on any page with the actual code only existing in one location. There are also sections you can change page by page. You can make it look however you want.


这篇关于网页的常见HTML部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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