1. cthedot
  2. cssutils
Issue #2 resolved

Add support for margin box rules

cthedot
repo owner created an issue

Please add support for margin box rules. They are [[http://www.w3.org/TR/css3-page/#margin-boxes|described in CSS3 Paged Media]] and allow adding boxes such as headers and footers in the page’s margin area.

The CSS looks like this:

{{{ Alexander Page { margin: 3cm; @top-left { content: "..."; } } }}}

Note that the same CSSPageRule can contain both declarations and at-rules (margin box rules).

Margin box rules are similar to page rules in that they contain declarations, but they have no selectors and are of one of [[http://www.w3.org/TR/css3-page/#margin-box-def|16 types]] (eg. top-left, top-center, ...)

In the public API, CSSPageRule objects would gain a .cssRules attribute (and maybe .insertRule() and .deleteRule() methods) that would behave the same as in CSSMediaRule.

cssRules on a CSSPageRule would contains instances of a new class CSSMarginBoxRule (or some other name). As well as the API common to all rules, these objects would have a .style attribute like that of CSSPageRule. They would also need a way to tell of which of the 16 types a particular rule is. The .atkeyword attribute can help, but some normalization would be good.

Comments (3)

  1. Log in to comment