I want to create a website, where instead of copying the <head>
tag to each new page. I want to put it in its own file just reference it in each page.
I tried using <object data="head.html">
, with head.html having a link to style.css. But instead of changing the entire body background color to red, it just made a small red rectangle.
index.html
<!DOCTYPE html>
<html>
<head>
<object data="head.html"></object>
</head>
<body>
<p>Hello</p>
</body>
</html>
style.css
body{
background-color:red;
}
head.html
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
</html
I expected it to make the entire page red with the word "Hello" in it, but it made a small red rectangle with "Hello" under the rectangle.
I see that other question, however I'm not very experienced with using java script in web pages.