W3C home > Mailing lists > Public > www-style@w3.org > November 2014

[css3-page] Proposing @margin for marginalia

From: Tobias Herp <tobias.herp@gmx.de>
Date: Sat, 01 Nov 2014 11:53:39 +0100
Message-ID: <5454BBB3.7040500@gmx.de>
To: www-style@w3.org

I'm a web programmer and for quite some years now *using* CSS; I think I
have found a use case where CSS could easily provide an elegant
solution, but it currently doesn't:

There currently seems to be no standard-conforming way to define a
margin column on pages - a space for marginalia
[https://en.wikipedia.org/wiki/Marginalia] which are very common for
technical books. (I'm no English native speaker, so feel free to suggest
a better wording.)

Currently, e.g. for PDF generation, we need to use vendor-specific APIs
to detect left and right pages and change styles accordingly by
Javascript (which might or might not be available, and might or might
not work correctly).
In my opinion, this is a job for CSS.

The following ruleset:

  @page :left {
    padding-left: 32mm;

    .marginalia {
      display: block;
      float: left;
      clear: both;
      margin-left: -32mm;
      width: 30mm;

  @page :right {
    padding-right: 32mm;

    .marginalia {
      float: right;

is *disallowed*, according to section 5.1 of the Paged Media Module:
"The current level of this specification only allows margin at-rules
inside ‘@page’."

Thus, to allow for marginalia, we have two options:

- Drop the restriction to only allow margin at-rules
  (which would be misunderstood as an invitation to put
  all kinds of stuff here),
- Define a special area, inside the page margin-boxes.
  This would be my choice.

My proposal has two components:

- an at-rule to create the margin column,
  e.g. "@margin";
- a possibility to put elements there,
  e.g. "position: margin".

Using string-set like for @right-middle etc. would not be an option,
IMO; it would be far more complicated in both definition and use, and
less flexible; images, HTML <sub> elements and the like will certainly
be needed in marginalia.

Instead of many words, here is an example how the marginalia support
could look like:

  @margin {
    width: 32mm;         /* stealing width from the @page box */
    padding: 0 2mm;
    font-size: smaller;

  @page :left {
    @margin {
      text-align: right;  /* possible default for :left pages */

  @page :right {
    @margin {
      text-align: left;  /* possible default for :right pages */

  .marginalia {
    position: margin;

The @margin column would be on the right for :right pages, and on the
left for :left pages.  (For ltr languages, the first page is supposed to
be a :right page, which suits duplex printing nicely; section 4.3, "Page

If this can't be generally agreed on, it might be possible to extend the
syntax, e.g. like so:

  @page :left {
    @margin-right {


  @margin-inner {

There can only be *one* margin column in every page.
Unless explicitly specified for :left and :right pages:

- In presence of @margin, @margin-right would modify
  the existing @margin on :right pages
- In presence of @margin, @margin-left would modify
  the existing @margin on :left pages
- If both @margin-left and @margin-right are present,
  but not @margin,
  @margin-left applies on :left pages, and
  @margin-right applies on :right pages.
- If no @margin is present, or with @margin {display: none},
  @margin-right generates all margins
  on the right side (*like* on :right pages),
  e.g. for single-sided printing.

If suppressed, the margin would not occupy any space, and thus give back
it's width to the normal page content:

  @page :first {
    @margin {
      display: none;

Please tell me what you think.
Thank you!

Tobias Herp
Received on Saturday, 1 November 2014 10:54:09 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:26 UTC