• @page is specifically designed for defining print settings, including margins.
• The margin inside @page ensures that browsers recognize the 1-inch setting instead of defaulting to the system’s print settings.
• The page selector in your code does not exist in standard HTML and does not affect print styling.
大家好。您的问题可能源于两个主要问题:1. 选择器不正确 – 除非在 @page 规则中明确定义,否则 CSS 无法识别页面元素。2. 边距应在 @page 内设置 – 应用打印边距的正确方法是使用 @page。解决方案像这样修改您的 CSS:
现在,打印时,检查打印预览设置以确认边距设置正确。