简体   繁体   English

以`:right` CSS页面规则开始首页吗?

[英]Start first page with `:right` css page rules?

I have defined @page :left and :right margins like this: 我已经定义了@page :left:right边距,如下所示:

@page :left {
  margin-left: 0.75in;
  margin-right: 0.25in;
}

@page :right {
  margin-right: 0.75in;
  margin-left: 0.25in;
}

When I print using Chrome it always seems to start the document with the :left rules. 当我使用Chrome打印时,似乎总是使用:left规则开始文档。

Is there a way to have printing start with the :right rules? 有没有一种方法可以使打印从:right规则开始?

I'm most interested in a solution for Chrome, but I'd also be interested in solutions for Prince. 我对Chrome解决方案最感兴趣,但对Prince解决方案也很感兴趣。

您可以使用page-break-before css property来调整Chrome和Prince中的分页符(显然)。

CSS stands for "cascading style sheet" and the "cascading" means that it's read from top to bottom. CSS代表“层叠样式表”,“层叠”表示从上到下读取。 If you simply switch the order of your statements, it should read right first. 如果仅切换语句的顺序,则应首先正确阅读。

Placing the @page :right above the :left should do it. 将@page:right放在:left上方应该可以。

@page :right {
  margin-right: 0.75in;
  margin-left: 0.25in;
}

@page :left {
  margin-left: 0.75in;
  margin-right: 0.25in;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM