是否可以创建网站标题,而无需在每个页面上复制和粘贴它? [英] Is it possible to create a web site header without copying and pasting it on every page?

查看:78
本文介绍了是否可以创建网站标题,而无需在每个页面上复制和粘贴它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个小型网站(个人网站),每个网页都有相同的标题元素集(我不是在讨论< head>元素)。换句话说,我希望每个页面在页面顶部具有基本相同的标题,并且在下方具有相同的导航栏(每个页面可能存在细微差异)。这就好像StackOverflow在每个页面的顶部都有导航栏(标识,问题,标签等按钮)。

I'm building a small-scale website (a personal one) in which each page would have the same set of header elements (I'm not talking about the <head> element). In other words, I want each page to have essentially the same title at the top of the page and the same navigation bar below that (with possibly minor differences in each page). It's kind of like how StackOverflow has that navigation bar (with the logo, and the Questions, Tags, etc. buttons) on the top of every page.

有可能为每个网页创建一个这样的标题,而不需要复制和粘贴HTML代码来做到这一点?我真的不想遇到这样的情况:如果我想进行一次更改,我将不得不更改包含标题的所有页面。

Is it possible create such a header for every web page without copying and pasting the HTML code to do so? I really don't want to run into a situation where if I want to make a single change, I would have to change all of my pages containing the header.

推荐答案

真正的网站使用真正的Web框架,它有一个叫做布局的概念(至少这就是他们在Rails中所称的;正如Uwe的答案中所提到的,他们被称为主页在ASP.NET中)。所有常见的模板东西都进入了布局。

Real web sites use real web frameworks, which have a concept called a "layout" (at least that's what they're called in Rails; as mentioned in Uwe's answer, they're called master pages in ASP.NET). All the common "templatey" stuff goes into a layout.

这篇关于是否可以创建网站标题,而无需在每个页面上复制和粘贴它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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