2022-06-17 19:58:01 -07:00

1.4 KiB

title
Writing CSS

Conventions

Avoid inconsistent CSS units

Prefer using rem units, using only whole and half units, eg. 2rem or 1.5rem. If you need a specific pixel (px) measurement, use px and add comment explaining why you used it. The one exception is that 0.25rem is allowed.

Using rem units lets you change the scale of the UI by simply changing the body font size.

Always use HSL colors

All colors should be theme variables

Abilities

Omorphia leverages PostCSS to allow you to write in future-standards-compliant CSS. Browse the CSSWG drafts to see what is possible (not including stage 0).

Notable features:

Styles

Conform to BEM styling wherever possible. When working in components, you may want to leverage Svelte's conditional class shorthand instead of BEM's modifier class name format.