I am newly designing the web page using CSS,HTML and Jquery. I have designed the page having only the header part. That header page i want to use in different pages.I have referred Make header and footer files to be included in multiple html pages ,but still it is not working .
I have two html files. header.html which is working fine.Check it jsfiddle.net/Binay_Kumar/3xqwh/2/
And in my second page header1.html ,i want to link that header.html and some other content of the second page.
Coding
header.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<link href="../CSS/stylenew.css"type="text/css" rel="stylesheet" />
<div id="header">
<div id="codeoverheader">
X SERVICES PVT. LTD. </div>
<div id="codeoverheader1">
Home|Logout
</div>
</div>
<div id="header1"></div>
<div id="header2"></div>
<div id="backgroundofmenu1"> <!--I have changed as backgroundofmenu1 instead of backgroungofmenu-->
</div>
<div id="menu1">
<a href="secondpage1.html" style="text-decoration:none" id="menucolor" >My HomePage</a></div>
<div id="menu1line1"> <!--i have changed from 1 to 11-->
| </div>
<div id="menu2">
<a href="#" style="text-decoration:none" id="menucolor" class="Mydata">My Data</a></div>
<div id="menu2line2"><!--i have changed from 2 to 21-->
|</div>
<div id="menu3">
<a href="secondpage2.html" style="text-decoration:none" id="menucolor">Policies And Info</a></div>
<div id="menu3line3"><!--i have changed from 1 to 31-->
| </div>
<div id="menu4">
<a href="secondpage3.html" style="text-decoration:none" id="menucolor">Help</a> </div>
</head>
It is working fine.
header1.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<link href="../CSS/stylenew.css"type="text/css" rel="stylesheet" />
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script>
$(document).ready(function(){
$(function(){
$("#headerpage").load("header.html");
});
});
</script>
</head>
<body>
<div id="headerpage"></div>
<div id="hello">
hello
</div>
</body>
Some problem is there in this page.
stylenew.css
#header{
position:absolute;
top:0;
left:0;
width:100%;
height:header-<length>;
height:17%;
background-color:#004080;
}
#header1{
position:absolute;
top:15%;
left:0;
width:100%;
height:2%;
background-color:#9ABD2B; <!-- #CCFF33 first it was there -->
}
#hello{
left:300px;
top:200px;
position:absolute;
font-size:18px;
}
Anyway CSS is working fine ,as it is so lengthy ,so i am not sharing.
The problem is while running the header1.html it is displaying only hello but i am expecting the header.html page content as well as hello.
Can anyone tell what is the mistake i have done ?