Our reference docs for CSS properties contain a subsection of “Syntax” that’s called “Values”, which is generally a <dl>
. I’m interested in understanding the semantics of this subsection. My hidden agenda here is: could we express this as structured content, so it could be used by third-party applications like editors and devtools?
The simplest case is where the property is one that just accepts a set of keywords, like, say, color-adjust
. In cases like this each value is a permissible keyword, that’s also a possible value for the property as a whole. We could also see how exposing this as structured content could be helpful: for example an editor could provide the list of keywords (and associated descriptions) as possible autocompletions.
Outside this simple case things are much less clear. Quite often the “Values” items seem to be CSS data types (e.g. background-color
) or higher-level CSS values that are defined in the formal syntax (e.g. border-style
or border-left
- although in that case it appears as if perhaps the formal syntax is out of sync with the “Values” list).
Often in these cases, the “Values” items are not actually valid values for the property as a whole: they are more like annotations to the formal syntax. So the formal syntax describes the syntax of the whole property value, and the “Values” items explain individual items that appeared in the formal syntax.
In still other cases though, “Values” lists overall syntactical forms (e.g. in the docs for rotate
) and seems to be much more free-form (it’s a bit like a human-readable gloss of the formal syntax). grid-template
is a similar case, except that this uses sections of the formal syntax as the <dt>
items, rather than more free-form text.
So…what do we think the semantics of “Values” is supposed to be? If all the variations listed above are valid, it seems like it doesn’t really have any semantics, it’s just “anything goes”. And that might be a reasonable decision to make about this. That would mean that tools won’t be able to do much with it though.