css-houdini-drafts icon indicating copy to clipboard operation
css-houdini-drafts copied to clipboard

[css-properties-values-api] Expand the set of syntaxes for which initial-value is optional

Open LeaVerou opened this issue 4 years ago • 0 comments

I have lately been using @property a fair bit, and in nearly every real case, I had wished initial-value could have just been automatically set based on my syntax.

There are several cases where there is a very obvious default that works for the vast majority of cases:

  • <length>: 0
  • <number>: 0
  • <angle>: 0deg
  • <color>: transparent
  • <integer>: 0
  • <percentage>: 0%
  • <time>: 0s
  • <resolution>: 0dpi

In my experience, this would simplify over 90% of @property uses.

We discussed making all descriptors optional in #994, but that was mainly centered around inherits. Also, since initial-value is already optional for some cases, maybe it's more acceptable to make it optional for more cases?

LeaVerou avatar May 28 '21 14:05 LeaVerou