lightningcss icon indicating copy to clipboard operation
lightningcss copied to clipboard

Support page margin boxes

Open mischnic opened this issue 2 years ago • 3 comments

https://www.quackit.com/css/at-rules/what_is_a_page-margin_box_in_css.cfm

E.g.

@page {
  size: A4;
  margin: 10%;

  @top-left-corner { /* <---- */
    content: "Page " counter(page);
  }
}

currently results in Unknown at rule: @top-left-corner

mischnic avatar May 18 '22 07:05 mischnic

Thanks for reporting this @mischnic for me.

In the same file where I experience this I also have a weird bug with a 0 value. This seems to be ignored in parcel-css and I get huge margins, when I change them to 0.01px it renders more correct.

@media print {
  @page :first {
    margin-top: 0px;
    margin-left: 0px;
    margin-bottom: 0px;
    margin-right: 0px;
  }
}

kjvdven avatar May 23 '22 06:05 kjvdven

hmm, afaik unitless zero lengths are valid. What software are you using to render? A browser, or something else?

devongovett avatar May 24 '22 03:05 devongovett

currently results in Unknown at rule: @top-left-corner

Same here. We use an HTML-to-PDF converter that uses these @-rules. We would like to use parcel for building our templates, but the current limitations prevent us from doing so.

Trying to build:

@page {
  margin-top: 72px;

  @top-center {
    content: "test";
  }

  @top-right {
    content: "test2";
  }
}

Results in

@parcel/transformer-css: Unknown at rule: @top-center

rodogir avatar Aug 25 '22 11:08 rodogir