W3C home > Mailing lists > Public > www-style@w3.org > April 2013

[CSS Box Model] Metrics Snapping Proposal

From: Si Robertson <retromodular@gmail.com>
Date: Tue, 02 Apr 2013 07:41:55 +0000
Message-ID: <CAHh_GTHyHzmrVBYZT9hueQ3JWMgHtvWDRO8rYT4gqRoqR_DwGA@mail.gmail.com>
To: www-style@w3.org
Hello,

This is my first post to this mailing list so hopefully I am doing things
correctly here.

In a nutshell, I am proposing what is essentially a metrics based CSS rule
that forces the width and/or height of a DOM element to "snap" to a
multiple of a specified value. Here is an example of what the markup could
look like ...

element {
snap-width: 100px;
}

The math required to calculate the snapped value (the width in this case)
is simple ...

element_width = snap_width_value * ceil( element_measured_width /
snap_width_value )

I guess you could think of this behaviour as snapping the size of a DOM
element to a grid, and grids are something that are sorely missing from CSS
right now. There have been so many occasions when this would have been
super handy for me to have available, so hopefully I am not the only person
who would find this CSS rule useful.

Thanks for your time.

Regards,
Si Robertson
Received on Thursday, 4 April 2013 09:59:06 UTC

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