Let's assume:
- Margins: 0.3 inch
- Border: 3px
- A4: 8.27 x 11.69 inch
Since there is
- 96 CSS pixels per inch
- 72 points per inch
we get
element width: 72*(8.27 - 0.6 - 6.0/96) = 547.74pt
element height: 72*(11.69 - 0.6 - 6.0/96) = 793.98pt
<body style="width:547.74pt;height:793.98pt;margin:0;padding:0;background-color:grey;border:3px solid black">
</body>
The resulting pdf is attached.