Syntax Rules
A guide to adding custom syntax rules.
Overview
Name | type | Unit | Variable Namespaces |
---|---|---|---|
accent-color | Native | - | color |
align-content | Native | - | - |
align-items | Native | - | - |
align-self | Native | - | - |
animation | NativeShorthand | - | - |
animation-delay | Native | ms | - |
animation-direction | Native | - | - |
animation-duration | Native | ms | - |
animation-fill-mode | Native | - | - |
animation-iteration-count | Native | - | - |
animation-name | Native | - | - |
animation-play-state | Native | - | - |
animation-timing-function | Native | - | - |
appearance | Native | - | - |
aspect-ratio | Native | - | - |
backdrop-filter | Native | - | color |
background | NativeShorthand | - | color |
background-attachment | Native | - | - |
background-blend-mode | Native | - | - |
background-clip | Native | - | - |
background-color | Native | - | color |
background-image | Native | - | color |
background-origin | Native | - | - |
background-position | Native | px | - |
background-repeat | Native | - | - |
background-size | Native | rem | - |
blur() | - | - | - |
border | NativeShorthand | rem | color, color.line |
border-bottom | NativeShorthand | rem | color, color.line |
border-bottom-color | Native | - | color, color.line |
border-bottom-left-radius | Native | rem | border-radius |
border-bottom-radius | Shorthand | rem | border-radius |
border-bottom-right-radius | Native | rem | border-radius |
border-bottom-style | Native | - | - |
border-bottom-width | Native | rem | - |
border-collapse | Native | - | - |
border-color | NativeShorthand | - | color, color.line |
border-image | NativeShorthand | - | - |
border-image-outset | Native | rem | - |
border-image-repeat | Native | - | - |
border-image-slice | Native | - | - |
border-image-source | Native | - | - |
border-image-width | Native | rem | - |
border-left | NativeShorthand | rem | color, color.line |
border-left-color | Native | - | color, color.line |
border-left-radius | Shorthand | rem | border-radius |
border-left-style | Native | - | - |
border-left-width | Native | rem | - |
border-radius | NativeShorthand | rem | - |
border-right | NativeShorthand | rem | color, color.line |
border-right-color | Native | - | color, color.line |
border-right-radius | Shorthand | rem | border-radius |
border-right-style | Native | - | - |
border-right-width | Native | rem | - |
border-spacing | Native | rem | spacing |
border-style | NativeShorthand | - | - |
border-top | NativeShorthand | rem | color, color.line |
border-top-color | Native | - | color, color.line |
border-top-left-radius | Native | rem | border-radius |
border-top-radius | Shorthand | rem | border-radius |
border-top-right-radius | Native | rem | border-radius |
border-top-style | Native | - | - |
border-top-width | Native | rem | - |
border-width | NativeShorthand | rem | - |
border-x | Shorthand | rem | color, color.line |
border-x-color | Shorthand | - | color, color.line |
border-x-style | Shorthand | - | - |
border-x-width | Shorthand | rem | - |
border-y | Shorthand | rem | color, color.line |
border-y-color | Shorthand | - | color, color.line |
border-y-style | Shorthand | - | - |
border-y-width | Shorthand | rem | - |
bottom | Native | rem | spacing |
box-decoration-break | Native | - | - |
box-shadow | Native | rem | color |
box-sizing | Native | - | - |
break-after | Native | - | - |
break-before | Native | - | - |
break-inside | Native | - | - |
brightness() | - | - | - |
caret-color | Native | - | color, color.text |
clear | Native | - | - |
clip-path | Native | - | - |
color | Native | - | color.text |
column-gap | Native | rem | spacing |
column-span | Native | - | - |
columns | NativeShorthand | - | - |
contain | Native | - | - |
container | NativeShorthand | - | - |
container-name | Native | - | - |
container-type | Native | - | - |
content | Native | - | - |
contrast() | - | - | - |
counter-increment | Native | - | - |
counter-reset | Native | - | - |
cursor | Native | - | - |
cx | Native | - | spacing |
cy | Native | - | spacing |
direction | Native | - | - |
display | Native | - | - |
drop-shadow() | - | - | color |
fill | Native | - | color |
filter | Native | - | color |
flex | NativeShorthand | - | - |
flex-basis | Native | rem | - |
flex-direction | Native | - | - |
flex-grow | Native | - | - |
flex-shrink | Native | - | - |
flex-wrap | Native | - | - |
float | Native | - | - |
font | NativeShorthand | - | font-family, font-variant, font-weight, font-size, font-style |
font-family | Native | - | - |
font-feature-settings | Native | - | - |
font-size | Native | rem | - |
font-smooth | Native | - | - |
font-style | Native | deg | - |
font-variant | NativeShorthand | - | - |
font-variant-numeric | Native | - | - |
font-weight | Native | - | - |
gap | NativeShorthand | rem | spacing |
gradient() | - | - | color |
grayscale() | - | - | - |
grid | NativeShorthand | - | - |
grid-area | NativeShorthand | - | - |
grid-auto-columns | Native | - | - |
grid-auto-flow | Native | - | - |
grid-auto-rows | Native | - | - |
grid-column | NativeShorthand | - | - |
grid-column-end | Native | - | - |
grid-column-span | Shorthand | - | - |
grid-column-start | Native | - | - |
grid-columns | Shorthand | - | - |
grid-row | NativeShorthand | - | - |
grid-row-end | Native | - | - |
grid-row-span | Shorthand | - | - |
grid-row-start | Native | - | - |
grid-rows | Shorthand | - | - |
grid-template | NativeShorthand | - | - |
grid-template-areas | Native | - | - |
grid-template-columns | Native | rem | - |
grid-template-rows | Native | rem | - |
group | Shorthand | - | - |
height | Native | rem | - |
hue-rotate() | - | - | - |
hyphens | Native | - | - |
inset | NativeShorthand | rem | spacing |
invert() | - | - | - |
isolation | Native | - | - |
justify-content | Native | - | - |
justify-items | Native | - | - |
justify-self | Native | - | - |
left | Native | rem | spacing |
letter-spacing | Native | em | - |
line-height | Native | - | - |
list-style | NativeShorthand | - | - |
list-style-image | Native | - | - |
list-style-position | Native | - | - |
list-style-type | Native | - | - |
margin | NativeShorthand | rem | spacing |
margin-bottom | Native | rem | spacing |
margin-inline | NativeShorthand | rem | spacing |
margin-inline-end | Native | rem | spacing |
margin-inline-start | Native | rem | spacing |
margin-left | Native | rem | spacing |
margin-right | Native | rem | spacing |
margin-top | Native | rem | spacing |
margin-x | Shorthand | rem | spacing |
margin-y | Shorthand | rem | spacing |
mask-image | Native | - | - |
matrix() | - | - | - |
matrix3d() | - | - | - |
max-height | Native | rem | - |
max-size | Shorthand | rem | - |
max-width | Native | rem | - |
min-height | Native | rem | - |
min-size | Shorthand | rem | - |
min-width | Native | rem | - |
mix-blend-mode | Native | - | - |
object-fit | Native | - | - |
object-position | Native | - | - |
opacity | Native | - | - |
opacity() | - | - | - |
order | Native | - | - |
outline | NativeShorthand | rem | outline-width, outline-style, outline-offset, outline-color, color.line, color |
outline-color | Native | - | color, color.line |
outline-offset | Native | rem | spacing |
outline-style | Native | - | - |
outline-width | Native | rem | - |
overflow | NativeShorthand | - | - |
overflow-wrap | Native | - | - |
overflow-x | Native | - | - |
overflow-y | Native | - | - |
overscroll-behavior | NativeShorthand | - | - |
overscroll-behavior-x | Native | - | - |
overscroll-behavior-y | Native | - | - |
padding | NativeShorthand | rem | spacing |
padding-bottom | Native | rem | spacing |
padding-inline | NativeShorthand | rem | spacing |
padding-inline-end | Native | rem | spacing |
padding-inline-start | Native | rem | spacing |
padding-left | Native | rem | spacing |
padding-right | Native | rem | spacing |
padding-top | Native | rem | spacing |
padding-x | Shorthand | rem | spacing |
padding-y | Shorthand | rem | spacing |
perspective() | - | - | - |
place-content | NativeShorthand | - | - |
place-items | NativeShorthand | - | - |
place-self | NativeShorthand | - | - |
pointer-events | Native | - | - |
position | Native | - | - |
quotes | Native | - | - |
resize | Native | - | - |
right | Native | rem | spacing |
rotate() | - | - | - |
rotate3d() | - | - | - |
rotateX() | - | - | - |
rotateY() | - | - | - |
rotateZ() | - | - | - |
row-gap | Native | rem | spacing |
rx | Native | - | - |
ry | Native | - | - |
saturate() | - | - | - |
scale() | - | - | - |
scale3d() | - | - | - |
scaleX() | - | - | - |
scaleY() | - | - | - |
scaleZ() | - | - | - |
scroll-behavior | Native | - | - |
scroll-margin | NativeShorthand | rem | spacing |
scroll-margin-bottom | Native | rem | spacing |
scroll-margin-left | Native | rem | spacing |
scroll-margin-right | Native | rem | spacing |
scroll-margin-top | Native | rem | spacing |
scroll-margin-x | Shorthand | rem | spacing |
scroll-margin-y | Shorthand | rem | spacing |
scroll-padding | NativeShorthand | rem | spacing |
scroll-padding-bottom | Native | rem | spacing |
scroll-padding-left | Native | rem | spacing |
scroll-padding-right | Native | rem | spacing |
scroll-padding-top | Native | rem | spacing |
scroll-padding-x | Shorthand | rem | spacing |
scroll-padding-y | Shorthand | rem | spacing |
scroll-snap-align | Native | - | - |
scroll-snap-stop | Native | - | - |
scroll-snap-type | Native | - | - |
sepia() | - | - | - |
shape-image-threshold | Native | - | - |
shape-margin | Native | rem | spacing |
shape-outside | Native | - | - |
size | Shorthand | rem | - |
skew() | - | - | - |
skewX() | - | - | - |
skewY() | - | - | - |
stroke | Native | - | color |
stroke-dasharray | Native | - | - |
stroke-dashoffset | Native | - | spacing |
stroke-width | Native | - | - |
table-layout | Native | - | - |
text-align | Native | - | - |
text-decoration | NativeShorthand | rem | color, color.text |
text-decoration-color | Native | - | color, color.text |
text-decoration-line | Native | - | - |
text-decoration-style | Native | - | - |
text-decoration-thickness | Native | em | - |
text-fill-color | Native | - | color, color.text |
text-indent | Native | rem | - |
text-orientation | Native | - | - |
text-overflow | Native | - | - |
text-rendering | Native | - | - |
text-shadow | Native | rem | color |
text-size | Shorthand | rem | font-size |
text-stroke | Native | rem | - |
text-stroke-color | Native | - | color |
text-stroke-width | Native | rem | - |
text-transform | Native | - | - |
text-truncate | Shorthand | - | - |
text-underline-offset | Native | rem | spacing |
text-underline-position | Native | - | - |
text-wrap | NativeShorthand | - | - |
top | Native | rem | spacing |
touch-action | Native | - | - |
transform | Native | - | spacing |
transform-box | Native | - | - |
transform-origin | Native | px | - |
transform-style | Native | - | - |
transition | NativeShorthand | - | - |
transition-delay | Native | ms | - |
transition-duration | Native | ms | - |
transition-property | Native | - | - |
transition-timing-function | Native | - | - |
translate() | - | rem | spacing |
translate3d() | - | rem | spacing |
translateX() | - | rem | spacing |
translateY() | - | rem | spacing |
translateZ() | - | rem | spacing |
user-drag | Native | - | - |
user-select | Native | - | - |
variable | Shorthand | - | - |
vertical-align | Native | - | - |
visibility | Native | - | - |
white-space | Native | - | - |
width | Native | rem | - |
will-change | Native | - | - |
word-break | Native | - | - |
word-spacing | Native | em | - |
writing-mode | Native | - | - |
x | Native | - | spacing |
y | Native | - | spacing |
z-index | Native | - | - |
In Master CSS, most syntax rules are defined and implemented through the config.rules
. You can create your own custom syntax rules and use them directly within the class=""
attribute.
These custom rules are fully compatible with Master CSS’s advanced features, including selectors, at-rules, functions, and variables—offering a powerful and flexible styling experience.
Use this as a last resort when implementing your design system or styling conventions. Avoid creating custom syntax rules unless absolutely necessary, as overuse can lead to reduced maintainability and consistency across your codebase.
Add a custom syntax rule
Create your own syntax rule.
export default { rules: { foo: { unit: 'rem', declarations: { width: undefined } } }}
Use it in your markup:
<div class="foo:32"></div>
Generated CSS:
.foo\:32 { width: 2rem;}
Master CSS does not provide methods like declare
or transform
to let you fully customize the syntax, but instead exposes limited transformers
and declarers
to let you extend practical syntax rules. You should rely on the implicit behavior built into Master CSS to achieve the desired effect, but more often than not you will need config.components
.
Syntax rule types
Master CSS uses SyntaxRuleType
to determine the priority of CSS rule generation. By default, each rule is intentionally ordered to minimize style conflicts and reduce the need for overrides.
enum SyntaxRuleType { /** * utility classes * @example block, inline */ Utility = -4, /** * native shorthand * @example border, padding, margin */ NativeShorthand = -3, /** * shorthand * @example px, py, mx, my */ Shorthand = -2, /** * native properties * @example color, background-color, font-size */ Native = -1, /** * normal * @example grid-cols */ Normal = 0,}export default SyntaxRuleType