CSSWG approved the size
shorthand for width
and height
- Published:
The CSS working group (CSSWG) has decided to add the new shorthand property size
that will allow to specify values for the width
and the height
properties at once.
/* Before: */
.foo {width: 10px; height: 10px; }
.bar {width: 2em; height: 3em; }
/* After: */
.foo {size: 10px; }
.bar {size: 2em 3em; }
Until now, this was only possible with preprocessors. Moreover, as a property, this was only implemented in PostCSS. With other preprocessors including SCSS, it was needed to use mixins or workarounds like converting properties in a custom code-formatter class which is available in some implementations like scssphp.
The size
property available previously in @page
rules for the purpose of specifying page size for printing, is going to be renamed to page-size
, while size
inside @page
will now be an alias for page-size
.
One of those proposed the size
property was yours truly. Four years have passed since then. A similar time was taken by adding support for integer-ratio scaling with no blur to Intel and nVidia graphics drivers (AMD is still considering). That’s the speed of progress in the field of information technologies.
Let’s hope that adding CSS properties margin-x/y
, padding-x/y
, border-x/y
won’t take additional 12 years.