[Haskell-cafe] Re: Elegant & powerful replacement for CSS

Heinrich Apfelmus apfelmus at quantentunnel.de
Wed Feb 4 05:53:01 EST 2009

Conal Elliott wrote:
> I've been wondering for a while now what a well-designed alternative to CSS
> could be, where well-designed would mean consistent, composable, orthogonal,
> functional, based on an elegantly compelling semantic model (denotational).

Me too. I think there are several aspects

  1. Layout description, i.e.

        sidebar `besides` (content `above` footer)

  2. Visual properties, like red borders or blue backgrounds.
  3. Applying the style sheet to the document,
     i.e. to the semantic markup.

Current CSS is very weak at point 1, a clean box model in the spirit of
TeX or Lout


is preferable.

Point 2 is solved fairly well by current CSS. Background and border
colors are primitives, after all; so it boils down to a list of
attributes. But a higher-order language is preferably as well, for
example to capture common combinations in a variable instead of having
to cascade it.

Concerning point 3, CSS does ok for a hard-coded and specific output
medium. Ideally, one and the same content could be visualized for
different output media like web browsers (resizable), printer (PDF
quality) or an overhead projector. I imagine some kind of macro language
like LaTeX, Lout or XML "with macros"; but none of these examples are
elegant enough for my taste. It should be possible to embed other
languages for instance for mathematical formulas, highlighted source
code, etc.

I imagine that 3 is compiled to some kind of "CSS bytecode" consisting
of 2 and 1.



More information about the Haskell-Cafe mailing list