Unable to add border to print format with just CSS (Frappe 15)

I used the CSS here

.print-format {
    border: 2px solid black;
    padding: 10px;
    box-sizing: border-box;
}

And this works in the preview. But when I save it as a PDF it adds borders to everything inside it. So there will be multiple unneeded boxes in my PDF