Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Master page in HTML

Is there any way to create a similar idea as master/content page in ASP.NET in pure HTML?

I want to create several pages in HTML, but I want that all of them look the same with some contents different. Is there any way to do this without creating several pages which are very similar to each other?

like image 742
mans Avatar asked Mar 16 '11 22:03

mans


People also ask

What is a master page in HTML?

A master page is a template of an HTML page. It consists of <head> and <body> elements, where, for our purposes, the <body> element contains three <div> elements. In code, en-us. Copy Code.

Can we create master page HTML?

You can define the master page through the following steps: Copy and paste the HTML code from the sample files into the master page layout. Replace parts of the HTML code with web part zones. Add web parts to the web part zones.

What is Master page example?

A master page is an ASP.NET file with the extension . master (for example, MySite. master) with a predefined layout that can include static text, HTML elements, and server controls. The master page is identified by a special @ Master directive that replaces the @ Page directive that is used for ordinary .

What is the master page?

What is a Master Page? A Master Page is a nonprinting page that you can use as the template for the rest of the pages in your document. Master pages can contain text and graphic elements that will appear on all pages of a publication (i.e. headers, footers, page numbers, etc.)


2 Answers

//wait until the dom is loaded $(document).ready(function () {     //adds menu.html content into any "#menu" element     $('#menu').load('menu.html'); }); 

In reference to some of the other answers, iframes should be used carefully and sparingly. http://rev.iew.me/help-moving-from-iframes

http://fsvieira.com/2013/06/11/iframes-bad-for-a-website/

Duplicate question here with answer: How to create a master page using HTML?

like image 116
apohl Avatar answered Sep 23 '22 01:09

apohl


The simple way to do that is to use server side includes or SSI. However easier and, probably, much better solution would be usage of PHP with includes. This way you will always have additional PHP functionality then you need it. But both of this solutions require server that will preprocess the pages. If you want collection of pages, say, on a local hard drive, then only solution I know is already proposed iframe tag.

like image 37
Petr Abdulin Avatar answered Sep 24 '22 01:09

Petr Abdulin