Jordy Groote Jordy Groote - 1 year ago 75
CSS Question

How to change font-size of printable div

how can i change the font-style of the div i wwant to print?

this is the styling

@page {
size: A4;
margin: 0;
}
@media print {
.page {
margin: 0;
border: initial;
border-radius: initial;
width: initial;
min-height: initial;
box-shadow: initial;
background: initial;
page-break-after: always;
}
html, body {
width: 210mm;
height: 297mm;
}
}


Example:

html, body {
width: 210mm;
height: 297mm;
font-size: 1mm;
}


i tried everything the font-size is not getting smaller what am i doing wrong?
Any help is appreciated..

Answer Source

This should work. You should be able to see the changes in the print preview window. If you don't see the changes try adding !important to the css rule.

@media print {
 div {
   font-size: 1mm;
/*   font-size: 1mm !important;*/
  }

 /*Also move your @page css inside you @media css */
 @page {
     size: A4;
     margin: 0;
  }

}