W3C home > Mailing lists > Public > www-style@w3.org > August 2012

Re: conditional floats on paged media

From: Håkon Wium Lie <howcome@opera.com>
Date: Thu, 9 Aug 2012 00:45:17 +0200
Message-ID: <20514.60413.129278.14394@gargle.gargle.HOWL>
To: Michel Onoff <michel.onoff@web.de>
Cc: www-style@w3.org
Michel Onoff wrote:

 > You're writing a paper on computer science. For illustrative purposes,
 > you include short code snippets.
 > 
 > Since they are short and since you don't want the reader to be
 > distracted by back and forth page flipping to grasp the code, you
 > disallow page breaks inside the snippets.
 > 
 > On the other hand, you don't want to waste precious space either. You
 > are prepared for the snippets to be taken out of the normal flow and
 > floated on the top of the next page, but only if on the current page
 > there's no sufficient room in the natural position in the flow.
 > 
 > You only care that your snippets' listings are visually rendered as a
 > whole. You prefer positioning inside the normal flow if there's
 > sufficient room. Otherwise, you accept an out of flow positioning, on
 > the next page. Of course, you are prepared for forced breaks if the
 > snippets are longer than a page.
 > 
 > There are CSS working drafts about:
 > 
 > * "CSS Paged Media Module Level 3" (http://dev.w3.org/csswg/css3-page/)
 > * "CSS Generated Content for Paged Media Module"
 > (http://dev.w3.org/csswg/css3-gcpm/)
 > 
 > There are new float properties and controls for page breaks but they do
 > not seem to solve the problem above, not even when combined. Floats are
 > unconditional and avoiding page breaks wastes space.
 > 
 > Are there plans to add "conditional" floats to the mentioned specifications?

The proposed "snap" keyword is close to what you are asking for:

  http://dev.w3.org/csswg/css3-gcpm/#page-and-column-floats

You can e.g. set:

  pre.code {
    float: snap;
  }

That is, the code will float to the top of the next page if there
isn't room. If there is room, it will stay in its natual position --
unless the natural position is close to page breaks, in which case the
element will snap to the the top or bottom.

In a the WD, there's a more explicit keyword "unless-room":

 http://www.w3.org/TR/css3-gcpm/#float-modifiers

But I think the "snap" value is better and it should cover more cases.

-h&kon
              Håkon Wium Lie                          CTO °þe®ª
howcome@opera.com                  http://people.opera.com/howcome
Received on Wednesday, 8 August 2012 22:45:54 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:58 GMT