Propagating an old idea of Shinyu Murakami from the mailing list to Github issues, because I think it's the kernel of a great idea. I want to make sure it's available as a starting point for discussion.
The intended goal is to allow some page-based variation of fragments, of the type commonly requested in print workflows, eg:
- switching from single column to two column after the first page
- changing border-radius values depending on whether the page was left or right
Original email (and his followup):
https://lists.w3.org/Archives/Public/www-style/2013Sep/0046.html
https://lists.w3.org/Archives/Public/www-style/2013Sep/0292.html
Hello,
I would like to propose another approach: Use CSS Variables with @page :left/:right.
An example:
@page :left {
var-foo: 2em 0.5em 0.5em 2em;
}
@page :right {
var-foo: 0.5em 2em 2em 0.5em;
}
div {
border-radius: var(foo);
}
The problem here is that the var(foo) cannot refer the custom property 'var-foo' value set in the @page context according to the current spec.
We need to allow this usage, or to define another notation to refer the custom property values set in the @page context, e.g.:
div {
border-radius: from-page-context(var-foo);
}
Here the from-page-context() function retrieves the property value that the argument matches the property name, which can be custom (var-*) or normal properties, e.g.:
@page :left {
color: blue;
var-foo: 2em 0.5em 0.5em 2em;
}
@page :right {
color: green;
var-foo: 0.5em 2em 2em 0.5em;
}
div {
color: from-page-context(color);
border-radius: from-page-context(var-foo);
}
The concept of the from-page-context() function is similar to the from-page-master-region() function defined in the XSL-FO, although this XSL-FO's function only accepts very limited properties, and no custom properties, for now.
Regards,
Shinyu Murakami
Antenna House
Propagating an old idea of Shinyu Murakami from the mailing list to Github issues, because I think it's the kernel of a great idea. I want to make sure it's available as a starting point for discussion.
The intended goal is to allow some page-based variation of fragments, of the type commonly requested in print workflows, eg:
Original email (and his followup):
https://lists.w3.org/Archives/Public/www-style/2013Sep/0046.html
https://lists.w3.org/Archives/Public/www-style/2013Sep/0292.html
Hello,
I would like to propose another approach: Use CSS Variables with @page :left/:right.
An example:
div { border-radius: var(foo); }The problem here is that the
var(foo)cannot refer the custom property 'var-foo' value set in the @page context according to the current spec.We need to allow this usage, or to define another notation to refer the custom property values set in the @page context, e.g.:
div { border-radius: from-page-context(var-foo); }Here the from-page-context() function retrieves the property value that the argument matches the property name, which can be custom (var-*) or normal properties, e.g.:
div { color: from-page-context(color); border-radius: from-page-context(var-foo); }The concept of the from-page-context() function is similar to the
from-page-master-region()function defined in the XSL-FO, although this XSL-FO's function only accepts very limited properties, and no custom properties, for now.Regards,
Shinyu Murakami
Antenna House