Adopt CSS (Flexbox or Grid) terms for Typst

I do not know the inner workings of Typst’s layout model, besides having read this very cool post from the man himself TeX and Typst: Layout Models | Laurenz's Blog.

Anyway I really hope that Typst can one day adopt some of the same terms and semantics that CSS uses, so I do not have to learn an entirely new layout system.

For instance,

  • Instead of inset for the #box element, I would think of padding as the operative term here (coming from CSS).
  • Lots of web devs (including myself) love tailwindcss, and I could see a third party Typst package adopt some of the naming conventions for layout modifiers p-4 (for padding-top:4px,padding-right:4px,padding-left:4px,padding-bottom: 4px for pixels

Beyond just CSS terminology, if Typst could adopt some of the CSS model too, at least for my background that woulud be helpful. For instance, if typst could have a Flexbox or CSS Grid style layout (I am aware of the #grid element).

I think adopting CSS’s model or at least some of its terms would make it alot easier to approach laying out documents in Typst. I think CSS is the right model to adopt generally (and the most well known model) for laying out text on a 2D plane.

1 Like

Here is what comes to mind:

padding

See biceps – Typst Universe.

See gridlock – Typst Universe and oasis-align – Typst Universe.

I think there was some discussion about this. Considering that Typst will have a multipage (highly customizable?) HTML export (and EPUB export), I think there just might be some CSS related changes added. We’ll have to see.

1 Like

CSS needs more capabilities of dynamically resolving the layout compared to generating PDFs, I think. I’ve also talk about some logical properties in this RFC: RFC: Vertical Writing Mode · Issue #5908 · typst/typst · GitHub