Summary
It would be helpful to have a machine-readable list of CSS properties that accept unitless <number> or <integer> values (where units like px should not be added).
Use Case
CSS-in-JS libraries need to know which properties accept raw numbers without units. For example:
opacity: 0.5 (unitless)
z-index: 10 (unitless)
flex-grow: 2 (unitless)
line-height: 1.5 (unitless)
vs properties that need units:
width: 100 → width: 100px
margin: 10 → margin: 10px
Current State
The syntax field shows <number> or <integer> but doesn't clearly indicate whether the property is "unitless" in the sense that numeric values should NOT have units appended.
Proposed Enhancement
Add a unitless boolean field or similar indicator to properties that accept bare numbers:
{
"name": "opacity",
"syntax": "<alpha-value>",
"unitless": true,
...
}
Or alternatively, a separate list of unitless properties.
Affected Properties
Common unitless properties include:
opacity, fill-opacity, stroke-opacity, flood-opacity, stop-opacity
z-index, order
flex-grow, flex-shrink
line-height (when unitless)
font-weight (numeric values)
orphans, widows
column-count
tab-size (when specifying character count)
- And more...
Summary
It would be helpful to have a machine-readable list of CSS properties that accept unitless
<number>or<integer>values (where units likepxshould not be added).Use Case
CSS-in-JS libraries need to know which properties accept raw numbers without units. For example:
opacity: 0.5(unitless)z-index: 10(unitless)flex-grow: 2(unitless)line-height: 1.5(unitless)vs properties that need units:
width: 100→width: 100pxmargin: 10→margin: 10pxCurrent State
The syntax field shows
<number>or<integer>but doesn't clearly indicate whether the property is "unitless" in the sense that numeric values should NOT have units appended.Proposed Enhancement
Add a
unitlessboolean field or similar indicator to properties that accept bare numbers:{ "name": "opacity", "syntax": "<alpha-value>", "unitless": true, ... }Or alternatively, a separate list of unitless properties.
Affected Properties
Common unitless properties include:
opacity,fill-opacity,stroke-opacity,flood-opacity,stop-opacityz-index,orderflex-grow,flex-shrinkline-height(when unitless)font-weight(numeric values)orphans,widowscolumn-counttab-size(when specifying character count)