I echo out information into a div and I have a jQuery print element to print that div. But the paper is always printed off-center. How can I manage to design the div to print in the center of the page? is there an exact height/width to follow?
This is my div css class
.contract {
align: 0 auto;
text-align: center;
width: 800px;
background-color: #fff;
clear: both;
display: block;
}
Use this CSS
@media print {
#printDiv{
position:absolute;
width:300px;
height:300px;
z-index:15;
top:50%;
left:50%;
margin:-150px 0 0 -150px;
}
}
Value of Margin should be 50% of the width and height value
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With