[CSS Box Model] Metrics Snapping Proposal

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