Re: [csswg-drafts] [css-values] A more structured format for complex CSS values? (#6519)

So this sort of syntax has been brought up before. The big strike against is that if you can define the sub-parts of a property, you're already 90% of the way to just making the property a shorthand, with longhands like `box-shadow-color`, `box-shadow-inset`, etc. (And `box-shadow` and `text-shadow` have been requested to become shorthands for a long time, for precisely this reason.)

I don't know how much I agree with the reasoning - it's okay for single-value properties, but list-valued properties like box-shadow lose all the organizational benefit when you split them apart. It *would* be better if you could define each shadow in order, with named parts.

Using an at-rule is technically doable, but it means you have to define them out-of-band, and give them a name even if they're one-offs, and doing anything via the CSSOM APIs would get *way* more annoying since you have to manually construct the rules and insert them into a sheet, rather than just writing a string into `.style`. This is reasonable for things that are going to be reused and rarely modified, but not for arbitrary style values like a shadow.

Ultimately, I'm for something like this, but it would be quite an effort to define, since you'd probably want it to work for every existing shorthand in the language.

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6519#issuecomment-902989827 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 20 August 2021 22:30:08 UTC