Raw properties & CSS variables
Use any CSS property directly, set custom properties, and understand when a name is rejected.
NibCSS does not limit you to its shorthand list. If a name is a real CSS property, it is passed through.
Any real property#
<input value="Caret and accent" nib="caret-color=#e11d48; accent-color=#e11d48; p=8px 12px; bdrd=8px; bd=1px solid #cbd5e1">Custom properties (CSS variables)#
Names starting with -- are always accepted. Set a variable on a parent and read it anywhere below:
<div nib="--accent=#0891b2; d=flex; g=10px">
<span nib="p=6px 12px; bdrd=999px; bgc=var(--accent); cl=#fff">One</span>
<span nib="p=6px 12px; bdrd=999px; bd=2px solid var(--accent); cl=var(--accent)">Two</span>
</div>This is the idiomatic way to theme a subtree, or to feed a continuously changing value from JavaScript without generating a new rule each time:
<div nib="tf=translateX(var(--x))" style={{ "--x": `${x}px` }} />Vendor-prefixed properties#
<p nib="-webkit-line-clamp=3; d=-webkit-box; -webkit-box-orient=vertical; ovf=hidden">When a name is rejected#
A name that is neither a shorthand nor a known CSS property produces no CSS and a warning:
Unknown utility "trf" — did you mean "t", "tf", "trn"?This is deliberate — a typo never ships as a broken declaration.
Invalid values#
Values are checked where the set of valid values is finite (position, display, overflow,
text-align, flex/grid alignment, border-style, numeric properties like opacity and z-index):
"red" is not a valid value for "opacity" — opc is short for opacity — accepts 0.7, 0, .5, 10%, 75%By default the declaration is still emitted (the browser ignores it), so a false alarm never breaks a page.
With strict: true it is dropped instead. Lengths, colours and functions are never second-guessed.