javascript - Print a div with CSS -
i've been searching alot print div css, didn't output want, don't know why.
here's trigget show print popup:
<button id="print" onclick="popup('front')">here</button>
here's script:
function popup(data) { var div = document.getelementbyid(data).innerhtml; var mywindow = window.open('', 'new div', 'height=400,width=600'); mywindow.document.write('<html><head><title></title>'); mywindow.document.write( "<link rel=\"stylesheet\" href=\"ficha-tecnica-media.css\" type=\"text/css\" media=\"print\"/>" ); mywindow.document.write('</head><body >'); mywindow.document.write(div); mywindow.document.write('</body></html>'); mywindow.print(); mywindow.close(); return true; } </script>
and in ficha-tecnica-media.css
:
@media print { body{ font-family: arial, helvetica, sans-serif; } table{ font-size: 10px; } article{ font-size: 10px; } img{ width: 50px; height: 50px; } }
if put display:none
on img
works, im trying resize it, doesn't work. font-family
in body or font-size
don't work.. why?
Comments
Post a Comment