How to set margins 0 on print preview?

前端 未结 5 879
花落未央
花落未央 2021-02-01 19:04

Where am i doing wrong?

This is the normal print preview:

5条回答
  •  广开言路
    2021-02-01 19:33

    I'm prevented from upgrading a computer from Windows XP to something more recent, so basically I'm stuck with IE8.

    I found that on IE8, page margins will always be a minimum of 6.01mm left and right, and 5mm top and bottom. No matter what I do, even using @top-left right and centre rules inside the @page rule, it will still default to the values above.

    It may be easier to create the stylesheet to take into consideration this limitation on the print size.

    It may also help to put the IE hack \9 in front of the CSS class property value, duplicating the property may also help in some cases, (but won't affect the margins of the page), such as:

    .aDiv {
        margin: 10mm;
        margin: 15mm\9;     //this \9 hack will set that value only on IE8.
    }
    

    I know there are other hacks similar to this, such as \0 but I admit don't fully understand them. \9 works for me in IE8 in some situations.

提交回复
热议问题