Re: proposed new module: css3 floats and positioning

On Thu, May 19, 2011 at 01:53:22AM +0200, Håkon Wium Lie wrote:

> As a start, I'd like to challenge you to describe these use cases in
> your spec:
>
>   [...]
> 
>   - specify that a figure should snap to an edge if it come within a
>     certain range. For example, if a float appears with only two lines
>     of text below it, the float should snap to the bottom of the page
>     while the two lines of text should appear over it.

(I realize that the following is premature, but I might as well post it
 now so that it's in the archives in the same place if someone does
 get around to trying to add such a feature to a spec.)

The way that I implemented this sort of feature was in terms of
distance rather than number of lines of text.

The motivation we were considering was the case of whole-column-width
floats, and we didn't want there to be further body text below that
float that took up too little space for the reader to notice and read
this "island" of body text.

By this criterion, a distance measure rather than number-of-lines
measure would be the right thing for the case of a float followed by
the next section's heading and first line or two of that section, or
where there's a large amount of content that occupies only zero or one
line box according to the CSS way of counting.

Distance rather than number-of-lines would also be the right thing by
this criterion for the case of a float followed by a larger number of
small lines of text.

Distance may also be a bit easier to specify & implement than number of
lines.

Just to give one possible approach to this feature, the way I chose was
as a property on the element being floated.  (Actually two properties,
the other being the corresponding snap-to-top distance.)  The property
inherited by default (and had effect only on floats), with an initial
value of 0.  It allowed percentages, being interpreted as relative to
the page content area height (or whatever rectangle whose top/bottom
you allow snapping to, though we only considered the page content area
case).  Negative values were illegal, though I forget whether that was
a considered decision.  We didn't consider any of the issues relating
to vertical text.

As I say, all of the above is just what I implemented for our own needs
that no doubt differ somewhat from the more general posibilities that a
CSS spec would need to consider.  Though I hope it's of some help.

pjrm.

Received on Friday, 20 May 2011 05:22:48 UTC