Typographies

Lily names its type roles and lets the theme pick the face. A reader can resize the text, and the font follows the language of each element, so a Thai sentence is drawn in a Thai font whatever the page’s main language is.

When to use these styles

Use the role tokens for every piece of text: body, monospace, and the heading scale. They keep hierarchy, readability and the reader’s own settings working together.

When not to

Do not set a font size in vw alone, do not shrink text below 1rem, and do not pick a heading level for its size. Choose the level for the page’s structure and style it to suit.

Font stacks

This page is using these stacks right now, for the theme you have chosen.

Body
…
Monospace
…
Body line height
…

Lily names fonts and never ships them. A theme records its font and the font’s licence, and every stack ends in a generic family so there is always a fallback.

/* A theme defines only its Latin stack. */
:root { --lily-font-body-latin: "Inter", system-ui, sans-serif; }
/* The shared "Writing systems" section then builds --lily-font-body
   from it plus the system fonts for each element's [lang]. */

Writing systems

Mark the language on the element (lang="th") and the stack does the rest. Scripts with tall marks get a taller line height automatically.

  • Latin The quick brown fox jumps over the lazy dog.
  • Welsh (Latin) Mae’r ŵyr yn dysgu darllen ac ysgrifennu.
  • Arabic النص العربي يُكتب من اليمين إلى اليسار.
  • Hebrew עברית נכתבת מימין לשמאל.
  • Devanagari हिन्दी पाठ बाएँ से दाएँ लिखा जाता है।
  • Thai ข้อความภาษาไทยไม่มีช่องว่างระหว่างคำ
  • Japanese 日本語の文章は、漢字とかなを組み合わせて書きます。
  • Korean 한글은 음절 단위로 모아 씁니다.
  • Chinese (Simplified) 中文使用汉字书写。

Headings

Use one h1 per page and descend one level at a time. Screen reader users move between headings, so the outline matters more than the size. The specimen below shows a typical scale; your theme sets the real one.

Level 1: the page title

Level 2: a major section

Level 3: a subsection

Level 4: a group within a subsection

Level 5: a component heading

Level 6: the smallest heading

The specimen is set in plain text so it does not add headings to this page’s own outline.

Body text

  • Body text is at least 1rem, with a line height from --lily-line-height-body.
  • Keep lines to about 45 to 75 characters; the content-width tokens (--content-width-narrow to -wider) do this.
  • Align text to the start, not the left, so right-to-left scripts mirror correctly.
  • Do not justify text, do not use all capitals for sentences, and do not underline anything that is not a link.
  • Labels run up to 30 percent longer in other languages, so leave room.

The reader sets the size

The text-size picker sets data-text-size on the root, a seven-step scale that scales the root font size. Because everything is in rem, the layout follows. Test at the largest step and at 400 percent zoom.

  • smallest 80%
  • smaller 90%
  • small 95%
  • normal 100%
  • large 110%
  • larger 125%
  • largest 150%