I just want add header for every pages. So i use @media print. This is my code
@media screen {
div#parent {
display:none;
}
}
@media print {
div#parent {
position:fixed;
display:block;
top:0;
}
}
The problem is header have overlaped with every page
CodePudding user response:
You need to add a space between the content and your header. I don't know your html structure, but if you have something like this:
HTML
<html>
<body>
<div >
<!-- Your header here -->
</div>
<div >
<!-- Your page content here -->
</div>
</body>
</html>
You need to add some margin-top
or padding-top
to the class .content
, and it should work fine:
CSS
.content {
margin-top: 100px;
}
CodePudding user response:
You need to use include
method that php
gives us.
Imagine you have following structure:
app|
| header.html
| index.php
In your header, you will have the header you are using right now, and in the index.php, you will have to call that file. You can use <?php include "header.html"; ?>
Your index.php, should look like this:
<body>
<?php include "header.html"; ?>
<div >
<!-- Page Content Here -->
</div>
</body>