Home » Jquery » jquery – Understanding @media print in html

jquery – Understanding @media print in html

Posted by: admin February 22, 2020 Leave a comment

Questions:

I am trying to understand how @media print work in html. I created a page and I just want to print a div from that page. So I created the @media print and the div inside it. I want the page to be a standard paper size and I want the text to full up that page size when printing. How can I achieve this?

See my code below:

@media print {
    .myDivToPrint {
        background-color: white;
        height: 100%;
        width: 100%;
        position: fixed;
        top: 0;
        left: 0;
        margin: 0;
    }
}
How to&Answer: